Benches macOS

4

Automatically quit idle applications

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I have many users that are notorious for not quitting applications when they are done with them. They just leave them running and sitting idle sometimes for hours at a time. Is there a way to set the system to automatically quit an application after is as been idle for a set number of minutes. Is it possible to get really specific and say, for example, that I want application "A" to quit after 10 minutes of no activity? The computers in question are running a range of 10.2.8 to 10.4.11.

Ben

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    Camelot

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    And just how to you intend to determine 'idle' status?

    It is not sufficient to say that it hasn't been the frontmost application for x minutes because many applications can process data in the background.

    It is not sufficient to say that it has no windows open, because the application might not need any windows open to do its job.

    Some applications may include a 'state' flag that tells you what it's doing (e.g. iTunes will tell you if it's playing a track or not), but I don't ever recall seeing one that says how long it's been in this state. Therefore, even if you could use that approach, you'd have to periodically poll each application for its state and keep track of when it went into idle state.

    Given the very short list of applications that support this model, I can't think it's going to save you much time.

    The best solution here may be user education.

  2. 0

    Benjamin Simpson1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I've tried the user education route, but they just refuse to listen.

    It's mainly two applications that I want to automatically quit (Accelerated Reader Student, and Accelerated Reader Management). Perhaps a better way for me to think about it would be to have the application quit if the computer is idle after 10 minutes.

    I ran across something called ScriptSaver that will run a script when the screensaver activates. My knowledge of AppleScript is pretty basic, so please bear with me, but would it be possible to do something along the lines of say:

    When the screensaver starts, it runs a script where it says if either AR Management or AR Student is running, quit it?

    If these applications are in use, we don't want them running all the time. Some people don't pay enough attention, or just flat refuse to listen, that we had one instance where the student program ran for 10 days straight, through Christmas break. I have the computers set on a automatic schedule to start up and shut down (all but the 10.2 machines, that is), and the AR applications stop the logout and shutdown process if they are running.

    I know I can't tell the script to look for the process ID, since that will change all the time, but can I have it look for the Process Name as that never changes? Is what I'm thinking now even feasible? If so, any example you may be able to provide would be a great help.

    Ben

  3. 0

    Pandrake

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    This might work for your needs:

    --begin script, define the application names

    set app1name to "Accelerated Reader Student"

    set app2name to "Accelerated Reader Management"

    tell application "System Events" to ¬

    set appNames to name of every process

    --appNames is a list containing names of running applications, eg

    --{"loginwindow", "Dock", "SystemUIServer", "Finder", "iTunesHelper", ...etc.

    --check that list for the name of the applications you want to quit

    if appNames contains app1name then ¬

    quit application app1name

    if appNames contains app2name then ¬

    quit application app2name

    --end script

    There is also a thread on Macscripter's BBS about using AppleScript to find out whether or not an application is idle - tho it's very advanced use of terminal commands:

    http://bbs.applescript.net/viewtopic.php?id=5980

    Probably easier to use the screensaver-activates-applescript method.

  4. 0

    Benjamin Simpson1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    That worked perfectly. Thanks for your help