Pathnames to files

Hi :smiley:
I’ve had very limited experience of AppleScipt in OS 9, some years ago now, and I’m trying to re-educate myself with Applescript in OS X.

I’ve noticed that many things have changed (like ‘Record’ in Finder, etc). In fact, so many things have changed that I can’t seem to do the basics anymore.

For example, I tried this code which works successfully.
tell app “Finder”
open file “myFile” … (“myFile” is located on the Desktop.)
end tell

But when I try this code below, it doesn’t work.

tell app “Finder”
open file “myFile:Desktop:username:Users:HardDisk” … (path way to “myFile”)
end tell

Why won’t this code work?

Any help would be appreciated.


There’s a lot about scripting the OS X Finder that doesn’t work as well as in OS 9 — if at all. But you get used to it eventually. :slight_smile:

However, in this particular case, you’ve got the file path the wrong way round. It should begin with the disk name and work through to the file name.

thanks Nigel,

It worked!

I was sure I had tried both ways … but maybe I just thought I had.

Anyway, thanks for the quick reply.