Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Always keep an application open' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Always keep an application open
Authored by: trosberg on Jun 22, '11 01:03:42PM
I thought keeping and hiding an app is easier to carry out with an AppleScript app. An icon more in your Dock, though.
Keeps an application running. Hides it, when not in use.
Paste into AppleScript Editor. Save as an application with 'Stay open' ticked. 
Add the script app to your login items in System Preferences.
Tuomas Rosberg 2011

property appName : ""
property firstRun : false

on run
   if firstRun is false then -- this script app hasn't been opened
      set anApp to choose application -- launches and returns item application
      set appName to name of anApp
      set firstRun to true
   else -- firstRun is true in subsequent runs, continue to idling
   end if
end run

on idle
   tell application "System Events"
      if exists of application process appName then
         if frontmost of application process appName is false then
            set visible of application process appName to false
         end if
      else -- the app process does not exist
         tell application "Finder" to launch application appName
      end if
   end tell
   return 3 -- seconds to idle
end idle

[ Reply to This | # ]