Created
July 31, 2020 08:23
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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