Instantly share code, notes, and snippets.

Embed
What would you like to do?
Toggle Double-Click to Copy
Suspend, on
; Example #4: Detects when a key has been double-pressed (similar to double-click).
; KeyWait is used to stop the keyboard's auto-repeat feature from creating an unwanted
; double-press when you hold down the RControl key to modify another key. It does this by
; keeping the hotkey's thread running, which blocks the auto-repeats by relying upon
; #MaxThreadsPerHotkey being at its default setting of 1.
; Note: There is a more elaborate script to distinguish between single, double, and
; triple-presses at the bottom of the SetTimer page.
~LButton::
if (A_PriorHotkey <> "~LButton" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a MsgBox You typed "btw"-press.
KeyWait, LButton
return
}
Send, ^c
return
~$Insert::Suspend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment