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: Paul Skinner <email@hidden>
- Date: Sun, 2 Jun 2002 08:29:22 -0400
On Sunday, June 2, 2002, at 03:03 AM, Timothy Bates wrote:
Hi paul,
Thanks for your help
On 6/1/02 11:04 PM, "Timothy Bates" <email@hidden> wrote:
tell application "Finder" -- X.1.4
application process whose frontmost is true
-->Can't get application whose frontmost = true.
end tell
Nothing too serious is broken, Tim, or barely. That's improper syntax.
God
knows what Akua or other coercion got it to work for you in OS 9, if it
ever
did. (Actually there is an Akua term 'process' which may have come into
play
here.) [this works]:
This errors here. OS version 10.1.4. Applescript verion 1.8.2b4
tell application "Finder"
item 1 of (every application process whose frontmost is true)
end
'item 1' flagged.
Finder got an error: NSReceiverEvaluationScriptError: 3
But...
tell application "Finder"
item 1 of ((every application process whose frontmost is true) & "")
end tell
-->application process "Script Debugger"
If you get the 'name' property instead of the 'item 1 of'...
tell application "Finder"
name of (every application process whose frontmost is true)
end tell
-->{"Script Debugger"}
Hmmm...
tell application "Finder"
every application process whose frontmost is true
end tell
Returns a list-->{application process "Script Debugger"}
List's don't have 'name' properties. And yet the 'name of' script
returns a list containing the name property of the application process in
the list. So it must be applying the 'name' query to each item in the list
of processes. This is just what you'd want if you asked for the name of
every process. This look like an effect of the whose statement not wanting
to stop helping too soon. So, to disconnect the 'item 1' query from the
whose statement, you just need to make the list be resolved before asking.
..
tell application "Finder"
item 1 of ((every application process whose frontmost is true) as list)
end tell
-->application process "Script Debugger"
--
Can't make "old8tracks" into a record.
Paul Skinner
_______________________________________________
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.