How to run an Applescript when the computer has been idle?

I want to run an Applescript whenever my machine has been idle for x minutes. What's the best way to have something sitting in background, and run it once when the keyboard hasn't been touched in a set time?

Mac Pro, OS X 10.10

Posted on Jul 10, 2021 7:20 AM

Reply
3 replies

Jul 10, 2021 8:28 AM in response to VikingOSX

I may be missing something but I don't see what part of that post addresses the "do it after the machine has been idle". It has an "on idle" main loop, but doesn't that just mean "do it while the Applescript is running in idle mode"? Or am I missing the point - is it really going to run only when the machine has been idle (in which case, where do you specify how long)?

Jul 10, 2021 11:46 AM in response to Michael Levin

I think the idle handler is part of the answer and I believe obtaining the System idle time value and comparing it to your x minutes (converted to seconds for AppleScript) is another part of the solution. When the idle timer exceeds your desired elapsed time x, then perform some action.


I have been attempting to get this to work here, and failing forward…

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to run an Applescript when the computer has been idle?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.