Reputation: 43
Basically what I want is the F9 key to be transformed into Ctrl+W when it is pressed for under 500ms and into Esc for any duration above 500ms. Thx
Upvotes: 0
Views: 221
Reputation: 10543
$F9::
Keywait, F9, T0.5 ; waits 0.5 seconds maximally for F9 to be released
if ErrorLevel ; pressed for above that time
Send ^w
else
Send {Esc}
Return
or
$F9::
Keywait, F9, T0.5 ; waits 0.5 seconds maximally for F9 to be released
if ErrorLevel ; pressed for above that time
{
KeyWait, F9 ; wait for F9 to be released
Send ^w
}
else
Send {Esc}
Return
https://www.autohotkey.com/docs/commands/KeyWait.htm
Upvotes: 1