• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trigger script when an app is no longer frontmost?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trigger script when an app is no longer frontmost?


  • Subject: Re: Trigger script when an app is no longer frontmost?
  • From: Paul Skinner <email@hidden>
  • Date: Tue, 4 Mar 2003 01:11:26 -0500

On Saturday, March 1, 2003, at 05:10 AM, Andy Ihnatko wrote:

What's the best way to trigger a script whenever a user switches out of a specific app? Like, say I wanted an app to automatically minimize its windows automatically whenever I switch to another application.

Do I have to specifically write an on-idle handler that keeps track of frontmost apps, or is there a slicker solution?

Hiding the previous app (option while switching apps) not good enough for you?

If not, something like this will work for sensible applications.

on idle
tell application "Finder"
set FrontmostApplication to (name of every process whose frontmost is true) as string
end tell
if (FrontmostApplication as text) is not "TextEdit" then
tell application "TextEdit"
set miniaturized of every window to true
end tell
end if
return 2
end idle

If you want to avoid an on idle-stay open script, then you'd have to either switch to another app via a script; u-g-l-y; or attach a script to the app in some manner. That's very unlikely to be an option.

Paul Skinner
_______________________________________________
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.

References: 
 >Trigger script when an app is no longer frontmost? (From: Andy Ihnatko <email@hidden>)

  • Prev by Date: Date formatting
  • Next by Date: Re: Eudora and "Macintosh information"
  • Previous by thread: Trigger script when an app is no longer frontmost?
  • Next by thread: Q:Remote Apple Events on OS X server
  • Index(es):
    • Date
    • Thread