For any given target of SetTimer (Label, function or boundfunc), then using SetTimer, % A_ThisTimer, Off inside it will turn it off.
Code: Select all
fn := Func("MyFunc").Bind(1)
SetTimer, % fn, 100
return
MyFunc(var){
if (var)
SetTimer, % A_ThisTimer, Off
}
"[v1.1.01+]: If Label is omitted, A_ThisLabel will be used. For example, SetTimer,, Off can be used inside a timer subroutine to turn off the timer"
Saying "A_ThisLabel will be used" is misleading. In the above example, A_ThisLabel cannot be used to stop the timer - SetTimer, % A_ThisLabel, Off does not work for a boundfunc. However, SetTimer, , Off does work. So A_ThisLabel is not used, something else is.