Re: Process whose frontmost *was* true?
Re: Process whose frontmost *was* true?
- Subject: Re: Process whose frontmost *was* true?
- From: Graff <email@hidden>
- Date: Thu, 27 May 2004 12:47:46 -0400
Under Mac OS X the Finder actually calls System Events to do just this.
You can shorten the script to just:
Finder version:
----
tell application "Finder"
set frontProcess to every process whose frontmost is true
end tell
----
System Events version:
----
tell application "System Events"
set frontProcess to every process whose frontmost is true
end tell
----
Both scripts work the same and they eliminate the need for a repeat
statement.
- Ken
On May 27, 2004, at 10:48 AM, David Durkee wrote:
You might try using a different triggering program. I tried this
script:
tell application "System Events"
set apps to application processes
repeat with anapp in apps
if frontmost of anapp is true then
set aname to name of anapp
display dialog aname
exit repeat
end if
end repeat
end tell
Executed from iKey, it currently displayed whatever was in front at
the time I pressed the key. There might be a reason why Key Xing is
discontinued.
David
On May 24, 2004, at 12:02 AM, Jeff Porten wrote:
First, apologies. I'm sure I've seen this discussed before, but I
can't find it in a fulltext search of AS-Users, or in Google efforts.
If my answer is easily found by a search I forgot to try, consider
the wet noodle already applied in 30 lashes.
I have an AppleScript that I'm calling with a keystroke (via Key
Xing, a discontinued SysPrefs hot-key app), and which I want to
branch into different functions depending on what application is
frontmost. Testing works fine by manually activating an app, and
telling System Events to return the process whose frontmost is true.
But when I run the script in real usage, the frontmost app is Key
Xing Listener. And I don't see a secondmost boolean.... I've tried
telling Key Xing Listener to hide, but since it's faceless, no dice.
I've also tried a delay (on the theory that the Listener just needed
a second to get out of the way), but further lack of dice resulted.
My rummage through AS-Users found a command to tell the Finder to
return a frontmost, which looked promising until it always returned
"Finder".
My gut says I'm complexifying this -- what am I missing?
_______________________________________________
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.