How Do I Use the same hotkey to run/stop a macro?

Hey all,

Want to use the hotkey ⌘G to trigger a macro (do something in endless loop)
and then use the same hotkey to stop the running of this macro (cancel all running/pending instances… I use “semaphore lock” to prevent multiple instances running at the same time)

Sounds pretty simple, but couldn’t find an answer…

Possible?

In this case you do not want to use a semaphore lock.
Use a global variable to indicate if your macro is running.

This macro should give you an idea of how to do this. Of course you will need to adapt to your specific needs, and assign a hot key trigger.

MACRO:   Toggle Start/Stop of Macro [Example]


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/b/d/bd4a0aaaa73953dfce8d2c8284d54a153703f098.kmmacros">Toggle Start-Stop of Macro [Example].kmmacros</a> (5.8 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|612x1715](upload://tJzyIewUsXFuSbd7Fksq6yUQBOV.png)
2 Likes

@JMichaelTX

AMAZING! Thank you so much man! Exactly what I wanted to achieve!!

Hope this post will be indexed by Google for other folks that will look in the future for the same thing :wink:

1 Like