Re: Application and application process are legacy in OS X finder suite: how do I find the frontmost app?
Re: Application and application process are legacy in OS X finder suite: how do I find the frontmost app?
- Subject: Re: Application and application process are legacy in OS X finder suite: how do I find the frontmost app?
- From: Christopher Nebel <email@hidden>
- Date: Sun, 2 Jun 2002 11:14:48 -0700
On Sunday, June 2, 2002, at 12:03 AM, Timothy Bates wrote:
tell application "Finder" --10.1.4
item 1 of every application process whose frontmost is true
-->Worse: Finder got an error: NSReceiverEvaluationScriptError: 3
end tell
It was the last one that caught me - just plain buggy.
That's no bug, that's a feature! See the 2nd edition ASLG, p. 172
(Objects and References : Reference Forms : Every Element): "If you
specify an Every Element reference as the container for a property or
object, the result is a list containing the specified property or object
for each object of the container. The number of items in the list is the
same as the number
of objects in the container."
Therefore, that statement is actually asking for each application
process's item 1. Since application processes don't have item elements,
you get an error. If you actually mean the first item of the list of
every application process whose frontmost is true, then you should
either ask for the first application process, or say "item 1 of (get
every ...)" -- "get" forces complete evaluation of the expression.
Yes, I know some applications (not to mention AppleScript built-in
types!) don't do it this way, but those are bugs.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.