Software to prevent fast double-clicking?

thewhat

Member
May 9, 2010
186
6
76
I have a faulty mouse. Sometimes it will automatically click 2, 3 or 4 times on a single click.

Those extra clicks are all very fast, so I'm wondering if there's a way to separate them from legit, human double clicks.

Note: I would still like to use double clicking when I choose to.
 

thewhat

Member
May 9, 2010
186
6
76
I found a solution with AutoHotkey.
This script prevents multiple clicks with less than 100ms between clicks:

Code:
LButton::
If (A_TimeSincePriorHotkey < 100) ;hyperclick
Return
sendinput {LButton down}
KeyWait, LButton
sendinput {LButton up}
Return
(If you need for R or middle click, replace LButton with RButton or MButton)


If anyone has any other suggestions they're welcome.
 

Munky

Diamond Member
Feb 5, 2005
9,372
0
76
Call the mouse vendor and yell at them for making faulty mice :p Depending on how old it is, it might still be under warranty. My Logitech mouse developed a tendency to double click whenever it felt like it, but was still under warranty, so I called them up and they sent me a replacement.
 

thewhat

Member
May 9, 2010
186
6
76
I'm sure you guys mean well, but I would appreciate it if we stayed on topic.
I don't mean to be rude, but I posted in 'Software for Windows' for a reason.
(Besides, "get a new mouse" is not incredibly insightful, even if it was on topic. :p)

Anyway, AHK is working nicely so far. I doubt I'll find anything more appropriate for the job..
So unless there's something better out there, hopefully this will be of use to someone else.
 

Fardringle

Diamond Member
Oct 23, 2000
9,200
765
126
I'm sure you guys mean well, but I would appreciate it if we stayed on topic.
I don't mean to be rude, but I posted in 'Software for Windows' for a reason.
(Besides, "get a new mouse" is not incredibly insightful, even if it was on topic. :p)

Anyway, AHK is working nicely so far. I doubt I'll find anything more appropriate for the job..
So unless there's something better out there, hopefully this will be of use to someone else.

Honestly, if the mouse is malfunctioning (which it is), then "get a new mouse" is perfectly insightful and exactly on topic. If your car's brakes are failing, you wouldn't ask a mechanic to recommend a ship anchor to stop the car so that you can pretend to ignore the real problem.

Actually, now that I think about it some people might do just that, but it's not the proper resolution for the problem... ;)
 

thewhat

Member
May 9, 2010
186
6
76
Thanks. Very bare (no settings) but I'll give it a try.
EDIT: Doesn't seem to work for middle clicks.


Honestly, if the mouse is malfunctioning (which it is), then "get a new mouse" is perfectly insightful and exactly on topic. If your car's brakes are failing, you wouldn't ask a mechanic to recommend a ship anchor to stop the car so that you can pretend to ignore the real problem.
If I posted in 'Peripherals' asking "My mouse is malfunctioning, what do I do?" then perhaps "get a new mouse" would be a relevant (even if way too obvious) answer. I specifically asked for software to prevent fast double clicking.

But if you think using a piece of software to prevent fast clicks is somehow comparable to using a ship anchor to fix the brakes of a car, I'd really like to hear more. I know it's not the ideal solution, but is there something risky about using such software?
 
Last edited:

corkyg

Elite Member | Peripherals
Super Moderator
Mar 4, 2000
27,370
239
106
Hmmm! I've always been able to control click/double click speeds in Control Panel/Mouse. That doesn't work?
 

thewhat

Member
May 9, 2010
186
6
76
No, that setting only lowers the threshold to allow slow double clicks (as you move it towards 'Slow'), but it doesn't filter out the fast ones.
 

pyonir

Lifer
Dec 18, 2001
40,855
319
126
I used MouseFix on mine, but only the left button was double clicking on a single click. I just used MouseFix until my new mouse arrived.

If it happens on more than one button...good luck, then it's new mouse time. What mouse is it? You can try taking it apart and repairing the micro switches. It's odd that all of yours have gone bad though, which makes me wonder if it's not a bigger issue than just worn switches. Here's a repair guide for a random mouse: http://www.overclockers.com/mouse-clicking-troubles-diy-repair/
 

GratefulLeopard

Junior Member
Jan 6, 2018
1
2
1
I found a solution with AutoHotkey.
This script prevents multiple clicks with less than 100ms between clicks:

Code:
LButton::
If (A_TimeSincePriorHotkey < 100) ;hyperclick
Return
sendinput {LButton down}
KeyWait, LButton
sendinput {LButton up}
Return
(If you need for R or middle click, replace LButton with RButton or MButton)


If anyone has any other suggestions they're welcome.

This solved my problem and was also my first introduction to the program Autohotkey.

For both of those things I'm very grateful.

Thank you : D
 

ao_ika_red

Golden Member
Aug 11, 2016
1,679
715
136
I found a solution with AutoHotkey.
This script prevents multiple clicks with less than 100ms between clicks:

Code:
LButton::
If (A_TimeSincePriorHotkey < 100) ;hyperclick
Return
sendinput {LButton down}
KeyWait, LButton
sendinput {LButton up}
Return
(If you need for R or middle click, replace LButton with RButton or MButton)


If anyone has any other suggestions they're welcome.
I know it's 8 years old but this helps me avoiding further frustration and extending life of my not so old mouse. C'mon Logitech, get a grip with your microswitches!
 

Vitch

Junior Member
Oct 24, 2020
1
0
6
I know it's 8 years old but this helps me avoiding further frustration and extending life of my not so old mouse. C'mon Logitech, get a grip with your microswitches!
Hello,
Same as previous poster 8 years later this thread helped me solve my mouse issues. Thank you to initial poster and to the solution provider.
The autohotkey code works but has some undesirable effects like ignoring meta keys statuses (shift ctrl alt) here is the version that I ended up using (it ignores any mouse button press or release if it happens too fast and is then followed by a return to the previous state)
Code:
LButton::
sleep 20
if (GetKeyState("LButton", "P")) {
  sendinput {Blind}{LButton down} 
} else {
}
return


LButton up::
sleep 20
if (!GetKeyState("LButton", "P"))
{
  sendinput {Blind}{LButton up}
}
return
 

Rusvul

Junior Member
Dec 7, 2009
9
0
66
Providing a 3 year bump because this info was useful to me as well. AutoHotKey is all kinds of useful. I was already using it to not accidentally Alt+F4 or pop open the Start menu while playing certain games that use a ton of keybinds (looking at you World of Warcraft). The script suggested here will extend the usable life of my mouse that started the double-click behavior. Better than trying to pop the thing open and fix the clicker, probably more likely to break it completely that way. Software debounce ftw.

Edit - oh yeah, the middle click on my mouse also stopped working, AutoHotKey helped me there by remapping mddle click to another button (even now not all applications will allow for button remaps. Yes, even in 2023.) Anyway, AutoHotKey = crazy useful.
 

Davy803

Junior Member
Jun 22, 2024
1
1
6
Bumping again in 2024 with an updated AHK script based on the above ones plus some tweaks to make it work better for me with drag & drop, as well as supporting key modifiers. Also updated to support AHK v2.0

Code:
#Requires AutoHotkey v2.0

; Threshold for "too fast" in milliseconds
Threshold := 50

; To log debug output, set a log file path
LogFilePath := ""

*LButton::
{
  ; If it's too fast, ignore it
  if (A_TimeSincePriorHotkey != '' and A_TimeSincePriorHotkey < Threshold)
  {
    flog "skipping double click"
    Return
  }
  ; Otherwise, if button is still down send the key press as normal
  if (GetKeyState("LButton", "P")) {
    sendinput "{Blind}{LButton down}"
  }
}

*LButton up::
{
  ; If it's too fast, don't ignore it, just wait 20ms
  if (A_TimeSincePriorHotkey != "" and A_TimeSincePriorHotkey < Threshold)
  {
    flog "Waiting before up"
    sleep 20
  }
  ; If it is no longer pressed, send button up.  If it's still down, don't send button up
  ; This combination ensures that drag & drop works properly even in a double-click scenario
  if (!GetKeyState("LButton", "P"))
  {
    sendinput "{Blind}{LButton up}"
  }
}

; file log
flog(params*) {
  if (LogFilePath != "") {
    ts := FormatTime(, "yyyy-MM-dd HH:mm:ss.") substr(A_TickCount, -3)
    ; s := A_TickCount
    ; ts := substr(s,-6,3) "." substr(s,-3)
    for , param in params
      message .= param . " "
    FileAppend ts " " message "`n", LogFilePath
  }
}
 
  • Like
Reactions: Sydd_Gribbler

Sydd_Gribbler

Junior Member
Aug 15, 2024
1
0
6
As someone with a failing M510 from Logitech, and an unwillingness to simply replace (I can afford a new one, and I assume the OP can too) things that are dying, I appreciate this thread.

I will first look into actual disassembly because I don't use AHK for anything now, and I also have an aversion to running unnecessary software. I have fun quirks. ;)