My mouse sometimes double cliks with a single click

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ElViejoZunY
Posts: 8
Joined: 31 Mar 2019, 18:13

My mouse sometimes double cliks with a single click

07 Dec 2021, 20:45

Hello everyone. My mouse is kinda crappy. It isn't the first problem it has. It maybe happens 1 in 50 but it really messes my work. I used https://doubleclicktest.com/ to check how fast it double clicks and the most has been 0.09 (ms I guess). Before I had a similar problem with the middle click

viewtopic.php?p=415222#p415222

The problem now is that adding that to my script but changing MButton and Middle for LButton and Left fixes the double click problem but I can drag things or move slider bars.

Since I'm already asking for things, I have a similar problem but with my space bar (yes, both my mouth and keyboard are crappy and I bought them together) so if anyone can tell me how to modify the other script or a new one to fix this other problem, I'd appreacite it.

Thanks for reading.
User avatar
mikeyww
Posts: 26880
Joined: 09 Sep 2014, 18:38

Re: My mouse sometimes double cliks with a single click

07 Dec 2021, 21:18

Code: Select all

#UseHook
LButton::
Space::
SetKeyDelay, 25
KeyWait, %A_ThisHotkey%, T.1
If ErrorLevel ; Held
 If Instr(A_ThisHotkey, "Button") {
  Send {%A_ThisHotkey% down}
  KeyWait, %A_ThisHotkey%
  Send {%A_ThisHotkey% up}
 } Else While GetKeyState(A_ThisHotkey, "P")
  Send {%A_ThisHotkey%}
Else Send % A_PriorHotkey = A_ThisHotkey && A_TimeSincePriorHotkey < 400 ? "" : "{" A_ThisHotkey "}"
Return
#UseHook Off
ElViejoZunY
Posts: 8
Joined: 31 Mar 2019, 18:13

Re: My mouse sometimes double cliks with a single click

07 Dec 2021, 22:28

Thanks, I wasn't expecting an answer so soon. So far the first one seems to work. I changed it to 100 instead of 400 because double clicking intentionally was becoming hard, almost random to get, but it works okay with 100.

I'm trying the second one right now. Correct me if I'm wrong but the second one is about the space bar, not the left click, right? So I should use both, not one or the other, right?
ElViejoZunY
Posts: 8
Joined: 31 Mar 2019, 18:13

Re: My mouse sometimes double cliks with a single click

07 Dec 2021, 22:30

Sorry for the double post but I just noticed that you edited the code, I'll try with that one now.
User avatar
mikeyww
Posts: 26880
Joined: 09 Sep 2014, 18:38

Re: My mouse sometimes double cliks with a single click

07 Dec 2021, 22:55

Yes, I simply combined them. The script essentially blocks double-clicking (most of the time). This was my understanding of your intent, though it could be wrong! As you can see, with a mouse button hold, the button is held; with a keyboard key hold, the key is repeatedly sent. Without a hold, the key does nothing if it had already been pressed within 400 ms (or whatever number you use).
ElViejoZunY
Posts: 8
Joined: 31 Mar 2019, 18:13

Re: My mouse sometimes double cliks with a single click

08 Dec 2021, 03:48

I've been using it for almost 5 hours now. It mostly solves the problem but it isn't perfect. I had like two double spaces and 4 unintentional double clicks. It brings new problems thought. Some times the space bar takes too long tow ork so the next key inputs faster than the space bar, the underlined text was an unintentional example. Another problems is that I can't click and drag the things that I want because the click input take too long to work and fort he time I moved the cursor it inputs over another file (Imagine I have files 1,2,3 and 4 next to each other in that order, if I want to drag file 1 after file 4, the click takes so long that the mouse will be over file 2 or 3 andd rag that file, not file 1).

I tried changing the SetKeyDelay value to someone lower 5 but I don't see any difference.

Edit: This is probably a problem from how bad my keyboard is but I thought I should say it just in case. I noticed that if I press the sides of the space bar and not the middle, sometines it'll input 4 spaces. That never happened before.
User avatar
mikeyww
Posts: 26880
Joined: 09 Sep 2014, 18:38

Re: My mouse sometimes double cliks with a single click

08 Dec 2021, 06:57

Hence my earlier qualification, "most of the time"....

It's an issue of timing. I don't have a perfect solution, because if you want to be able to hold the key and also not hold it, a time threshold would need to be set. Others here may have some better ideas.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Nerafius and 98 guests