Applescript question

Ken Ray kray at sonsothunder.com
Sat Mar 19 01:50:21 EST 2005


On 3/18/05 6:41 PM, "Howard Bornstein" <howard.bornstein at gmail.com> wrote:

> I am currently calling an application from within Rev with the "tell
> <application> to activate" applescript command. But I'd like to know
> what application was active when this was called (it won't be Rev,
> since this is running in the background) so I can reactivate it after
> the script is finished.
> 
> Is there a way to use Applescript to find out the currently active
> application? Forgive my utter ignorance about Applescript.

No problem... here's what I use:

    tell application "System Events"
      get the name of every application process whose frontmost is true
    end tell

If you're using OS 9, tell the Finder instead of System Events. The reason
this works is that there can only be one process whose frontmost is true, so
it returns the name of the frontmost process.

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list