Path to applications folder?

Since the “path to” command seems to be set up for pre-OS X systems supporting the special folders:

apple menu/application support/control panels/control strip modules
/desktop/desktop pictures folder/extensions/Folder Action scripts/fonts/help
/launcher items folder/modem scripts/plugins/preferences/printer descriptions
/printer drivers/printmonitor/

how can I find the path to the applications folder? (with no hard coding because it’s got to run on any system).

Thanks,

Dave

This should work.

set apps_ to path to "apps"
tell application "Finder" to open apps_

You might want to check out my Show Path Codes script for more codes that work with the ‘path to’ command.

– Rob

OK, I just found this: http://www.macscripter.net/faq/finder_osx.php
Which talks about “path to” in OS X.
But the information:


 -- APPLICATIONS FOLDER 
 path to application folder from System domain
 -- alias "Mac OS X:Applications:" 
 

appears to be wrong. On my machine (10.2.6) with Script Editor 2.0b I get an error:

NSCannotCreateScriptCommandError

path to “apps” from System domain

Cool! That does it. That was damn fast service Rob! Thank you.

Dave

If you’re interested, the official keyword form for the path to the (user’s) application folder is:

path to At Ease applications folder

The ‘At Ease’ is for historical reasons and the keyword’s not generally advertised. Most people prefer to use the unofficial string form:

path to "apps"

There’s a similar couplet for the user’s Documents folder:

path to At Ease documents folder
-- or:
path to "docs"

I have never heard of using ‘At Ease’ to locate user-based applications or documents folders. I hardly think it can be called ‘official’, especially when the dictionary offers the ‘user domain’ parameter just for this purpose:

path to "apps" --> "Macintosh HD:Applications:"
path to "apps" from user domain --> "Macintosh HD:Users:username:Applications:"

Well, the dictionary does not offer string parameters (“apps”, “docs”, etc.) for any of the ‘path to’ destinations. These are unofficial (and useful) cheats that people have discovered. The official (dictionary) way is to use keyword parameters. Ever since before Mac OS 8, the only ‘path to’ keywords that have worked for the Applications and Documents folders have been respectively ‘At Ease applications’ and ‘At Ease documents’. These still work in OS 10.2.6, defaulting to the ‘user domain’ folders. That’s what I meant by “official keyword form” - though admittedly they’re not advertised in the dictionary, so it would indeed be a bit strong to call them “official” without any further qualification. Whether or not you’ve ever heard of using them is … Well, I don’t really know what to say. :wink:

Here’s what Chris Nebel, of the AppleScript dev team, had to say on the topic when brought up on the applescript-users mailing list back in March 2001:

I don’t see anything related to ‘at ease’ when viewing Standard Additions (OS X 10.2.6) in Script Debugger, but it still works as advertised.
– Rob

Hi, Rob.

Thanks for your research. It would be fascinating to know how the way Script Editor “handles the data internally” prevents it from displaying dictionary entries. For what it’s worth, I don’t think anyone’s ever seen the ‘At Ease’ parameters while looking at the dictionary in Smile either. That just leaves Scripter…

PS. On a somewhat tangental note, how do you do quote attributions on this BBS?

Nigel Garvey asks: “PS. On a somewhat tangental note, how do you do quote attributions on this BBS?”

I’ve disabled them in this post in order to display them - that’s why your question isn’t within a normal quote block. :wink:

–plain quote with no attribution

– quote with attribution

You can also quote a previous post by using the quote button found at the top of each post.

– Rob

Also, on Nigel’s question about quoting, there is a BBCode help file available at the FAQ link at the yop of all pages. There is also a link that opens a new page with several examples of BBCode. It’s at the left hand bottom corner of the message body below the emoticoms…

Options
HTML is OFF
BBCode is ON
Smilies are ON

Quotes left on for this, so method not quoted. :wink:

THIS IS FUN! - but definitely to be used in moderation! Thanks, guys. :slight_smile: