File Paths

Here are some official words from developer.apple.com:

Aliases and Files

 

The following is the recommended usage:

  • Use an alias object to refer to existing file system objects.
  • Use a file object to refer to a file that does not yet exist.
  • Use a POSIX file specifier if you want to specify the file using a POSIX path.

I know if you are new to scripting then that probably doesn’t make much sense, or at least it just doesn’t mean anything. Basically different commands and different applications deal with files in different ways. Not much help, I know.

Again, the best suggestion I have is to google what you are trying to do. Need to open a file in photoshop? Google Applescript Photoshop Open File and look at the examples. Trial and error till it works.

Aliases (file must already exist):

set picture_Alias to alias "Hard_Disk:Users:myUser:image.jpg"
or
set picture_Alias to "Hard_Disk:Users:myUser:image.jpg" as alias

File Object (possibly doesn’t exist yet or program automatically translates to an alias):

set picture_Alias to "Hard_Disk:Users:myUser:image.jpg" as string

Posix Path (I usually only need this for shell scripts):

set picture_Alias to POSIX file "Hard_Disk/Users/myUser/image.jpg"

Need some more explanation on something covered here? Let me know  in the comments!

 

Add your comment

Your email address will not be published. Required fields are marked *