Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there a way to launch an application, such as Transmission, every time the computer goes idle (instead of sleeping)?

share|improve this question

5 Answers 5

up vote 5 down vote accepted

This is a very hard feat to accomplish, primarily because there is no specific definition of "Idle". The only programs I've seen to actually have idle features are Instant Messaging Clients and the recent Mac App Store releases of Growl. And those simply have a configurable time that goes off after the set number of minutes when there's no mouse/keyboard activity occurring.

There's been similar discussion on the Macworld Forums some years ago, and a specific post that essentially entails creating and running an AppleScript that will monitor your usage and launch an application when you go "idle".

property idleCheck : 20 as integer
property idleCheck_usr : 120 as integer
set timer to 0
on idle
    --Check idle time
    set idletime to do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'"
    set idletime to idletime as string
    set idletime to idletime as integer

    tell application "System Events"
        if idletime is less than idleCheck then (* 20 is 20 seconds. If a key was tapped within the idleCheck seconds, it quits the app. *)
            tell application "TextEdit" to quit

            return idleCheck -- checks again in ... seconds
        else
            if idletime is greater than idleCheck_usr then (*  If a key was tapped after the idleCheck_usr seconds it opens the app. *)
                tell application "TextEdit" to launch   
            end if

            return idleCheck
        end if
    end tell
end idle

In this case idle is only after 2 minutes, but you can easily change that to be longer if necessary. You will also want to modify the line to open Transmission instead of TextEdit.

Note that you will have to open this AppleScript and leave it running in order for the action (launching an application on idle) to ever occur.

share|improve this answer

If the screen saver starting is what you mean as idel you could look at ScriptSaver which makes itself into a screen saver and then when it is called it calls your AppleScript ad a screen saver.

share|improve this answer

Power Manager can be used to launch an application after inactivity.

As Jason mentions in his answer, Apple's implementation of idle time is difficult to predict. Power Manager uses a measure of inactivity based on user activity; this is easier to predict and more likely to be what you are looking for.

Power Manager - Launch an application after inactivity

share|improve this answer

How about Sleepwatcher?

"SleepWatcher 2.2 (running with Mac OS X 10.5 to 10.7, source code included) is a command line tool (daemon) for Mac OS X that monitors sleep, wakeup and idleness of a Mac. It can be used to execute a Unix command when the Mac or the display of the Mac goes to sleep mode or wakes up, after a given time without user interaction or when the user resumes activity after a break or when the power supply of a Mac notebook is attached or detached. It also can send the Mac to sleep mode or retrieve the time since last user activity."

To launch an app (using a command), you'd have to do something like the following:

open /Applications/Transmission.app
share|improve this answer

Have you tried using Scenario? It is on the Mac App Store. While I haven't tried it myself. It seems that it might do what you need. Hope this helps.

share|improve this answer
    
I was going to suggest running a personal Condor install on a machine but Scenario looks like it covers all the same ground and more and is Mac-specific. Very nice. –  Ian C. Feb 3 '12 at 2:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.