FYI, this is not really aimed at you, you clearly know enough to know when and when not to use a blocking wait.
This is more aimed at trying to stop noobs being taught the blocking wait pattern.
Consider this example from the documentation
Code: Select all
*NumpadAdd::
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
Loop
{
Sleep, 10
GetKeyState, state, NumpadAdd, P
if state = U ; The key has been released, so break out of the loop.
break
; ... insert here any other actions you want repeated.
}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
Take that example and extend it to also do the same for Right Mouse.
Code: Select all
*NumpadAdd::
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
Loop
{
Sleep, 10
GetKeyState, state, NumpadAdd, P
if state = U ; The key has been released, so break out of the loop.
break
; ... insert here any other actions you want repeated.
}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
*NumpadSub::
MouseClick, right,,, 1, 0, D ; Hold down the left mouse button.
Loop
{
Sleep, 10
GetKeyState, state, NumpadSub, P
if state = U ; The key has been released, so break out of the loop.
break
; ... insert here any other actions you want repeated.
}
MouseClick, right,,, 1, 0, U ; Release the mouse button.
return
It doesn't work properly and buttons can get stuck.
People will use the code in the examples as templates - and we are giving them bad templates simply to try and save one or two lines of code.
I can find a grand total of three code snippets in the AHK docs which use an up event hotkey - two
on this page and a side note
here. All other examples in the docs, from what I can see, use blocking waits to detect key release. Why do you think so many people do not seem to even realize that up event hotkeys even exist? Because the docs never use them as an example, even when they are the most appropriate way to do it.