鼠标连点双击修复脚本
Macos Hammerspoon
#Hammerspoon
local debounceTime = 0.13
local lastClickTime = 0
GlobalClickFilter = hs.eventtap.new({hs.eventtap.event.types.leftMouseDown}, function(e)
local currentTime = hs.timer.secondsSinceEpoch()
local timeDiff = currentTime - lastClickTime
if timeDiff < debounceTime then
print(string.format("已拦截连点! 间隔: %.4f", timeDiff))
return true
end
lastClickTime = currentTime
return false -- 放行本次点击
end)
GlobalClickFilter:start()
Windows11 AutoHotkey
- 设置开机自启:按下 Win + R 键,输入 shell:startup 并回车, 拖入ahk文件的快捷方式。
#Requires AutoHotkey v2.0
Threshold := 100
LastClickTime := 0
*LButton::
{
Global LastClickTime
CurrentTime := A_TickCount
TimeDiff := CurrentTime - LastClickTime
; 如果间隔小于阈值,则拦截(不做任何操作)
if (TimeDiff < Threshold) {
return
}
LastClickTime := CurrentTime
; 发送点击事件(保留拖拽功能)
Send "{Blind}{LButton Down}"
KeyWait "LButton"
Send "{Blind}{LButton Up}"
}
