Isso pode ser feito com um script de timer do AHK. Este script será registrado quando Caps Lock for pressionado e interceptará Capslock Up , permitindo que ele seja disparado somente se um determinado número de milissegundos passar. O tempo limite padrão é de 0,2 segundos, isso pode ser configurado na bandeja do sistema.
; AutoHotKey - Suppress CapsLock
; This is a modified version of a scrpt by Lexikos, taken from:
; http://www.autohotkey.com/board/topic/82509-software-fix-for-double-clicking-mouse/
RegRead minDelay, HKCU, Software\LongCapsLock, MinDelay
if ErrorLevel
minDelay := 200 ; Default setting.
#NoTrayIcon ; Hide initial icon.
Menu Tray, Icon, %A_WinDir%\System32\main.cpl ; Set icon.
Menu Tray, Icon ; Show icon.
Menu Tray, NoStandard
Menu Tray, Add, &Configure, TrayConfigure
Menu Tray, Add, E&xit, TrayExit
Menu Tray, Default, &Configure
Menu Tray, Click, 1 ; Single-click to configure.
Menu Tray, Tip, Long CapsLock
global _starttime
global timing := 0
CapsLock::
if (timing = 0) {
timing := 1
_startTime := A_TickCount
}
return
CapsLock Up::
if (timing = 1) {
_timeDiff := A_TickCount - _startTime
;MsgBox diff: %_timeDiff%
if (_timeDiff > minDelay) {
Send {CapsLock down}
}
timing := 0
}
return
TrayConfigure:
prompt := "Enter minimum duration needed to hold Caps Lock'n"
. "before it is toggled. The unit is milliseconds."
Loop {
InputBox newMinDelay, Long CapsLock, %prompt%,,,,,,,, %minDelay%
if ErrorLevel ; Cancelled?
return
if (newMinDelay+0 >= 150 && newMinDelay <= 10000) ; Valid?
break
if (A_Index = 1)
prompt .= "'n'nPlease enter a number between 150 and 10000."
}
minDelay := newMinDelay
if (minDelay = 200)
RegDelete HKCU, Software\LongCapsLock
else
RegWrite REG_DWORD, HKCU, Software\LongCapsLock, MinDelay, %minDelay%
return
TrayExit:
ExitApp