• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get Finder and System Events confused
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >How to get Finder and System Events confused (From: Olof Hellman <email@hidden>)

  • Prev by Date: Re: (OT) Creator or Signature?
  • Next by Date: Re: max script size
  • Previous by thread: Re: How to get Finder and System Events confused
  • Next by thread: Re: How to get Finder and System Events confused
  • Index(es):
    • Date
    • Thread