I created a script with a toggle hotkey which runs and stops 3 loops co.
the first time I press it, it starts the first loop while the others are disabled, the second time I press it, it stops the first loop and starts the second, etc.
The problem is that the break command doesnt work at all.
To make it clearer, I replaced break with msgbox.
here is the code I use
Code: Select all
#MaxThreadsPerHotkey 4
toggle := 0
breakloop1 := 0
breakloop2 := 0
breakloop3 := 0
F12::
KeyWait F12
toggle++
if (toggle = 1) {
breakloop1 := 0
breakloop2 := 1
breakloop3 := 1
goto sub1
}
if (toggle = 2) {
breakloop1 := 1
breakloop2 := 0
breakloop3 := 1
goto sub2
}
if (toggle = 3) {
breakloop1 := 1
breakloop2 := 1
breakloop3 := 0
goto sub3
}
Return
sub1:
Loop
{
if breakloop1 = 1
msgbox sub1
sleep 500
tooltip 1
}
Return
sub2:
Loop
{
if breakloop2 = 1
msgbox sub2
sleep 500
tooltip 2
}
Return
sub3:
toggle := 0
Loop
{
if breakloop3 = 1
msgbox sub3
sleep 500
tooltip 3
}
Return
esc::exitapp
so what am I doing wrong here?