I think I'm missing something fundamental: How do I Start AND stop a macro by same trigger?

I've just started using KM and it's excellent, I'm kicking myself for not playing with it years ago. I've gotten the basic things I want to do working, but now I'm struggling with how to best control the macros themselves.

I have several looping macros, I activate it and it performs my repetitive task over and over. Works great. I've got some simple fail states like when the target app is no longer in front. Also easy and works great. I even figured out the dialog to variable in order to pre-define a number of loops or how long to loop.

But what I cannot figure out is how to (easily) cancel the macro the same way I started it! I mostly want to do this via the palette, but hotkeys as well. So something simple like this:

Is there a universal way to say "When the palette entry is clicked again, stop"?

I tried wrapping it in an If/Then checking if it's active, but that doesn't seem to work:

I also tried the same thing using a variable to track state, but still doesn't work as expected.

But even if there's another problem preventing the above, they both seem too complex for this task, which is why I feel like I'm missing something basic...

It should be a very rare case where you actually need an infinite loop.
But when you do need it, then something like this should work:


Macro A

  1. Set Variable StopMacroA to "false"
  2. While all of the following are true
    Chrome is at front (OR any condition that you want)
    Variable StopMacroA is "false"
    1. do something

image


Macro B

  1. Set Variable StopMacroA to "true"

Trigger Macro A to start your workflow
Trigger Macro B to STOP Macro A


Make sense?

Thanks.

So I really desperately irrationally needed this to be a single clickable toggle, so I was able to do so in an acceptably simple way like this:

Which seems to work fine:
2018-10-15_09-31-04

Although I still think it would be handy to have a more simplified GUI solution, like just a tickbox when you use the palette trigger for "make this a toggle".

Barring that it would be handy if there was a "this" type variable for a macro to refer to itself - i.e. in the Switch above the Mark actions, if there was a "this" instead of having to select the macro then I could use local vars and then just drop that block into every macro without having to modify it.

Is there a formal feature request process?