Why my Semaphore does'nt work?

Hi,
I am new to Semaphore and was trying to make it work, but I can still run the macro two times in a row while it is running. What am I doing wrong?

In your first Action, the Semaphore Lock, click on the gear icon on the right and set a very short timeout:

Set it to timeout and abort the Macro after the minimum time, 1/00 second. And uncheck "Notify after timeout" - just like in the image above.

This will mean if one instance of the Macro is still running while you try and trigger a second instance, that second instance will start but abort after 1/100 second, efffectively not running.

action:Semaphore Lock [Keyboard Maestro Wiki].

Also, in this case you do not need the Semaphore Unock Action at the end of your Macro.

action:Semaphore Lock [Keyboard Maestro Wiki].

The key to understanding the logic of all this is that Semaphore locks are designed to stop Macro runs overlapping. In normal use without the timeout they simply queue Macros to wait for the first one to stop before starting the second.

3 Likes

thanks

1 Like

This key point took me quite a bit to understand and Keyboard maestro. There were several times I thought I needed the semiphore lock and didn't.

1 Like