Skip to content

Instantly share code, notes, and snippets.

@Pagliacii
Created July 31, 2020 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pagliacii/a50748266a4ff3736ad3e18eed1fba32 to your computer and use it in GitHub Desktop.
Save Pagliacii/a50748266a4ff3736ad3e18eed1fba32 to your computer and use it in GitHub Desktop.
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