AppleScript Programming/Aliases and paths

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Paths appear like this in AppleScript:

''(Drive volume label)'':''Directory'':''Subdirectory'':Filename

These paths are different than the current OS X standard w:POSIX path of files, which works like this (example leads to Applications folder:

/Volumes/Macintosh\ HD/Applications/

To set a standard Applescript alias to a POSIX path (for use in telling the Terminal, etc.), use this command:

 set newPath to (the POSIX path of oldPath)

assuming oldPath would be an alias or record of a finder item.

To convert a POSIX path to a standard Applescript alias (the inverse of the above command), use this command:

 set newerPath to (POSIX file newPath)