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 Berkowitz <email@hidden>
- Date: Sun, 02 Jun 2002 08:30:03 -0700
On 6/2/02 5:29 AM, "Paul Skinner" <email@hidden> wrote:
>
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"
>
It's just one of those "item" chestnuts that needs to be evaluated. Sorry I
didn't test first. This works fine:
tell application "Finder"
item 1 of (get every application process whose frontmost is true)
end tell
--application process "Script Debugger"
This is not exactly uncommon, and not a bug. I have to do it in Entourage
all the time. 'item' has another meaning to the Finder, so it's good that
it even works as it does here: I thought it might have to be taken out of
the Finder tell block after getting the list, but it doesn't. Having 'first'
treated as 'every' is a bug.
tell application "Finder"
item 1 of (get first application process whose frontmost is true)
end tell
--application process "Script Debugger"
--
Paul Berkowitz
_______________________________________________
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.