I was explained before on the forum how to program an autohotkey script to pause the script execution until alpha-numerical character has been entered, by using an input command:
Input, L, V L1 T2 ;wait until you start typing a letter and then proceed after the T2 pause
If (ErrorLevel = "Timeout") {
Send, {Tab 5}
Send, {Enter}
Return
}
I wonder if I can use Input or some other autohotkey command to do the same for non-alphanumerical keys, like arrow keys, or even key combinations. For example, I'd like for the script to count the time from my last arrow key press when I'm selecting an item from a drop-down list, and when the pre-set time threshold is passed to continue with the execution of the script.
EDIT:
Thanks to Blauhirn, the script works now the up and down keys are added :) (as long as the first key is typed in within the pre-set time period of two seconds in this example, notepad will be launched as soon as a pause of one second in typing is made)
!^+u::
Input, L, V L1 T2, {up} {down}
If (ErrorLevel = "Timeout") {
Send, {Esc}
Return
}
Loop { ;wait until you haven't typed an arrow key for 1seconds
Input, L, V L1 T1, {up} {down}
If (ErrorLevel = "Timeout")
Break
}
Run, %windir%\system32\notepad.exe
Return