Macro stop help.

Macro stop help.

Hello there, I need help with a loop. Just for an example, I set this spam button up. Hit the button, it infinitely clicks left click, good for spam clicker games and such. But I'm wondering how to set it up to stop repeating the action.
I would like to press the button, and it does the action indefinitely, without my help, like holding button, and setting it to stop on release.
My last mouse had macro function where I'd hit the button, and it would do the action (infinitely left click) until I hit the button again. 
The only way I can figure how to stop the loop is to set another mouse button to stop all looping when pressed, but that's a massive waste of a mouse button. 
Any and all help is appreciated.