A simple AHK click on click off

Right i am in now way a programmer just someone who has had to search long and hard to try to get a AHK script that works for me, I see many people asking for AHK scripts so thought i’d put mine up here as its a very simple script but it works well for me

It is simple just click button 1 starts the macro looping continuously until you cancel it, now i have it set up so you can cancel it with button 1 or button 2 just for the fact i have button 1 as ST and button 2 as AOE so i can cancel with button 2 then with another click of the same mouse button start the AOE and vise versa.

hope it helps someone

toggle = 0
#MaxThreadsPerHotkey 2
#ifWinActive World of Warcraft
{
$1::
Toggle := !Toggle
While Toggle{
Send {1}
sleep 100
}
return
}
toggle = 0
#MaxThreadsPerHotkey 2
#ifWinActive World of Warcraft
{
$2::
Toggle := !Toggle
While Toggle{
Send {2}
sleep 100
}
return
}