How To Stop a Specific Instance of a Running Macro

You can stop a specific instance of an executing macro with the Cancel a Specific Macro action.

Example 1:

Macro Doit, Trigger Shift-A
Actions:

Macro Cancel Doit, Trigger Shift-V

Example 2:

Macro Doit, Trigger Shift-A

  • If variable DND_Macro Doit is not empty
  • else
    • Do stuff
    • Set variable DND_Macro Doit to text “”

To handle the case where the macro fails or aborts for other reasons and so DND_Macro Doit is not cleared, you could go a little further and validate whether %Variable%DND_Macro Doit%, when it is not empty, is or is not in ExecutingInstances token. But probably this is not necessary, since the only result would be that pressing Shift-A in this case would “cancel” the already not running macro, and then pressing it again would start it.

2 Likes