Re: Determining frontmost application in OS X
Re: Determining frontmost application in OS X
- Subject: Re: Determining frontmost application in OS X
- From: John Stewart <email@hidden>
- Date: Thu, 18 Jul 2002 17:12:52 -0400
On 7/18/02 at 12:50 PM, the entity email@hidden spoke thusly
>
How can I test for the name of the frontmost application in OS X?
>
>
I have window-resizing scripts for Explorer 5 and Apple's Mail app, and they are completely
different. However, I think I can do something like this
>
(pseudo code):
>
>
if the frontmost application is "Explorer" then
>
(do the Explorer resize stuff)
>
end if
>
>
if the frontmost application is "Mail" then
>
(do the Mail resize stuff)
>
end it
>
>
>
The question is, how to figure out which application is the frontmost one. Telling the Finder to
get the processes gives me a list, but the first item in
>
the list is always "loginwindow."
>
<snip>
tell application "Finder" to get name of every process whose frontmost is true
--> {"Script Debugger"}
<end snip>
>
(result below)
>
{"loginwindow", "Finder", "AEServer", "Dock", "SystemUIServer", "PhotoStickies", "MooSB", "Show
Desktop", "Key Xing Listener", "Palm Desktop Background",
>
"Transport Monitor", "MoonMenuXBackgrounder", "ASM Controller", "System Events", "Mail",
"SecurityAgent", "Internet Explorer", "System Preferences",
>
"Script Editor"}
>
>
Can I get this list sorted "front to back?"
>
Yes easily but it may not be the result you expect, The first item in the list when I run this is
"System Events" and not Script Debugger but Script Debugger is what I visually percieve is the front
app.
tell application "Finder" to reverse of (get name of every process)
--> {"System Events", "Script Debugger", "Terminal", "iData", "Mailsmith 1.5", "MagicMenu Daemon",
"YKBackgrounder", "Youpi Key", "X-Assist", "Magic Menu", "escapepod", "DragThing", "LiteSwitch X",
"Silk", "WindowShade X", "iTunesHelper", "FruitMenu", "SystemUIServer", "Dock", "AEServer",
"Finder", "loginwindow"}
>
Thanks for your help.
_______________________________________________
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.