How to avoid the macro getting triggered second time if it is already running?

The macro triggers every 6 minutes but I have a variable condition (pause until 'allow macro' is ON) where the macro waits until the variable condition is met. Sometimes the variable condition does not meet for more than 6 minutes so macro triggers second time and waits.

So when variable condition is met, 2 instances of the same macro trigger simultaneously, which is problematic. How do I avoid this?

(I have a macro with only single action step {opening a URL} in the screenshot just for representation purpose)

Open workflowy URL.kmmacros (46.4 KB)

Insert a Semaphore Lock action at the beginning of your macro and set its timeout period to something short - one hundredth of a second should do it. Read up on semaphores in the wiki action:Semaphore Lock [Keyboard Maestro Wiki]

2 Likes

I was not aware Keyboard Maestro has such a feature. That helps.

I tried making sure that understood it correctly before coming here to respond.
I did understand it and it works.

Thank you.

1 Like

(a) I’m glad it worked and (b) it’s nice that you took the time to understand the approach since it’s not the most intuitive concept. :+1: :clap:

2 Likes