Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Preventing the left mouse button double-click in the small period, because the microswitch of my left mouse button has some damages. Base on the AutoHotkey script.
debounceLeftClick()
{
Sleep, 10
if !GetKeyState("LButton", "P")
{
n := 1
BlockInput, On
Loop {
Sleep, 10
if (n++ > 9)
break
}
Click
}
else
{
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
Loop
{
Sleep, 10
if !GetKeyState("LButton", "P") ; The key has been released, so break out of the loop.
break
}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
}
}
; hook the left mouse button clicks
LButton::debounceLeftClick()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment