Trigger: when Mac is idle (THEN STOP)

I wrote a macro which has a trigger "When Mac is idle for 6 minutes..." then do a series of actions.

I want this macro to run once (i.e. I want it to run when I leave my desk for more than 6 minutes). But my problem is that after I leave my desk for 6 minutes, it launches EVERY SIX MINUTES.

I'm trying to think of what logic I need. Something like: do the series of actions, then disable this macro until the Mac is no longer idle. Or something like that?

How do I do this?

Hey there, you could place the following disable macro action at the end of the macro in question:

Then you could place the same action (but with the enable option instead of disable) in whatever macro you are triggering when leaving your desk.

Thanks. The first part of what you're saying makes sense: add an action to the end of this macro to disable itself, that way it doesn't re-run every six minutes.

The second part doesn't; if I wanted to manually trigger a macro to start every time I left my desk, I wouldn't need the original macro at all -- I might as well manually trigger the original macro. :slight_smile: The logic is self-defeating. The goal was to be able to trigger this macro ONCE after six minutes idle, then not again until the computer becomes un-idle.

Hello @ddas ,

I haven't used the Idle-Trigger by my self until today but here is an idea

Make two Macros

  • the First Macro is just to enable and to run the Second Macro
  • the Second Macro does the stuff You want it to do when Your Mac becomes idle and then disables it self like @cdthomer mentioned above.

You can use the Second or in this case the Sub-Macro for every Idle Trigger you create and change it to whatever routine you want it to run depending on the Main-Macro.

let us know if you need more help

Greetings from Germany

Tobias

For some reason I was thinking you had a macro you triggered when leaving your desk... lemme think on this some more. :thinking:

Hi @ddas, with a little more information, I'm sure someone will come up with a suggestion that solves your problem.

Questions:

  1. Why not just deselect And every minute idle thereafter?

CleanShot 2022-01-26 at 08.24.00@2x


  1. What are you doing when the macro runs (in general terms)? I assume you are not putting your Mac in Sleep Mode?

  2. When you return to your computer after a 6min (or more) idle period, is there anything you do consistently (i.e., open a specific app, run a certain KM shortcut, etc.)?

  1. I'm confused by "and every minute idle thereafter" -- I already have that disabled. If I did enable it, it implies it would run every 1 minute (why 1 minute...seems arbitrary). But in any case, I don't see how this option would help me NOT run the macro.

  2. I don't put my Mac in sleep mode, but I do walk away from my computer many times per day, for unpredictable amounts of time, so that's why I'd love to have my computer doing specific work when I'm away.

  3. Unfortunately, no. I guess I could train myself to (e.g. manually re-enable this macro) but the whole point of KM was to try and automate it. :slight_smile:

Well, this is how I would approach this task. You need two macros as follows:

The first macro (Do When Idle Starts) triggers when your Mac is idle, then performs whatever actons you need and then ends by enabling the second macro and also disabling itself.

The second macro (Check When Idle Over) periodically tests whether your Mac is still idle and if it isn't, it enables the first macro so it's ready to perform again if your Mac becomes idle once more and also disables itself.

Here's the two macros:
Do When Idle Starts.kmmacros (3.2 KB)
This needs to be enabled when you've installed it.

Check When Idle Over.kmmacros (3.7 KB)
This needs to be disabled when you've installed it.

KM 0 2022-01-26_21-34-28

With this one you need to insert those actions you want to perform once your Mac is idle.

KM 1 2022-01-26_21-38-10

In this macro I've set it to check for idling every 15 seconds all the time. You may want to change this.

I've tested this only minimally but it seems to work. I suggest you give it a try to ensure it works for you.

Let us know how you get on.

3 Likes

Ah yes. That's pretty ingenious. And exactly what I need. Thank you!

2 Likes

You’re welcome. I wasn’t absolutely sure I had understood completely what it was you were trying to do, but if it addresses your problem please mark it as the solution so users with a similar need in the future can find the answer quickly. Cheers!

1 Like