RE: Applet by Function Key needs previous frontmost
RE: Applet by Function Key needs previous frontmost
- Subject: RE: Applet by Function Key needs previous frontmost
- From: Joe Kelly <email@hidden>
- Date: Wed, 23 Jan 2002 12:46:44 -0800
This is how I would do it: create a standalone applet with an idle handler
(call it "CurProc"). You can store it in the Startup Items folder and forget
about it (if you're feeling frisky, turn on "Background-only application" in
the applet's SIZE resource [using ResEdit or Resourcerer]). This solution
requires Akua Sweets.
------------------
global gName
on run
set gName to "<undefined>"
end run
on idle
set list1 to all processes without background only
set list2 to all processes as integer without background only
set x to frontmost process
repeat with i from 1 to count of list1
if (item i of list2 is x) then
set gName to item i of list1
exit repeat
end if
end repeat
return 10 -- this is the poll interval in seconds
end
on GetFrontProcessName()
return gName
end
-----------------
Then when your function key script needs to know which app is up front, you
would call:
tell application "CurProc" to set x to GetFrontProcessName()
-- et voila!
joe
>
-----Original Message-----
>
From: Dave Saunders [mailto:email@hidden]
>
Sent: Wednesday, January 23, 2002 7:28 AM
>
To: AS list
>
Subject: Applet by Function Key needs previous frontmost
>
>
>
It occurred to me that I could associate an AppleScript applet with a
>
function key using the Mac OS 9 Keyboard control panel.
>
>
But, those function keys are universal. So, the Applet (and
>
it's got to be
>
an applet or I'll just end up firing up Script Debugger)
>
needs to know which
>
is the frontmost application.
>
>
Except that it will be the frontmost. What the applet needs
>
to know is which
>
was the previous frontmost application.