Macro to quit apps after 30 minutes of idleness

I frequently leave several apps open on my MacBook. I am trying to create a macro to help me quit the idle apps after 30 minutes of inactivity in the particular app.
How do I go about it?

1 Like

I used to use this setup to quit apps:

Quit Triggers
Quit Paperless
Triggered by any of the following:
Application ā€˜Paperlessā€™ deactivates
Will execute the following actions:
Pause for 300 Seconds
Notify on failure.
If All Conditions Met
Application ā€˜Paperless.appā€™ is not at the front
Execute the Following Actions:
Quit Paperless
Otherwise, Execute the Following Actions:
Cancel This Macro

But now I use SuperTab, which is easier to configure hiding and quitting applications in the background. Thereā€™s probably an AppleScript script that you could also use.

1 Like

Its tricky (and probably a bad idea) to do it for all applications, but if there are specific applications, then you can do something like this:

Macro: Quit MyApp
Trigger: MyApp Deactivates
Actions:
Set variable "My App Deactivates Time" to calculation NOW()
Pause 30 Minutes
if application MyApp is not at front and calculation NOW()-My App Deactivates Time > 29*60 then
    Quit MyApp
1 Like

I follow everything you've done here, and when I click on the cogs and select "Try" the actions are working -- but my macro isn't executing. Have I done something wrong?

(NB in this image "5 seconds" is just for testing: I'll change it later to 300.)

That ā€œtryā€ button is a little confusing. You have to actually select something for it to do anything (unless Iā€™m mistaken). So either you can select all the actions and click try, or better yet, assign a hot key trigger.

But you should be aware that your macro will actually be running, if PowerPoint is running, even if youā€™re editing the macro. Thatā€™s the danger of timers.

Itā€™s much safer, when testing, to turn off the timer and rely on a hot key. Thatā€™s what I think, anyway, for what itā€™s worth!

Thanks! I managed to get it to work, in the end.