Re: How to get Finder and System Events confused
Re: How to get Finder and System Events confused
- Subject: Re: How to get Finder and System Events confused
- From: Emmanuel <email@hidden>
- Date: Wed, 19 Mar 2003 09:44:54 +0100
At 6:52 PM -0800 18/03/03, Olof Hellman wrote:
Under OS X, 10.2.4, This succeeds:
tell application "Finder"
set frontProcessFile to (file of process 1)
container of frontProcessFile
end tell
--> folder "CoreServices" of folder "Library" of folder "System"
of startup disk of application "Finder"
But this fails:
tell application "Finder"
container of file of process 1
end tell
--> Finder got an error: NSCannotCreateScriptCommandError
As you would certainly guess, this works:
tell application "Finder"
container of (get file of process 1)
end tell
Personally, I would not say that this is a bug. I was rather
impressed by the Finder OS9 about how prone it was to evaluate
quantities, saving many a superfluous "get". Finder OSX seems to be
more reluctant, and to favor staying at the reference level.
The ambiguity comes from the fact that "container of file of" *could*
make sense in itself, in which case it would be a very bad idea to
evaluate "file of" first.
I would say that on a general point of view, it's better to write
"get" when you know that you are writing an ambiguous quantity and
you know that you want its value. "file of process 1" is obviously a
valid reference, since you can "set" it.
Emmanuel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.