User Tools

Site Tools


autohotkey_recipes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
autohotkey_recipes [2026/03/19 15:23] tkbletscautohotkey_recipes [2026/03/19 15:23] (current) tkbletsc
Line 33: Line 33:
 !`::Send +#{Right} !`::Send +#{Right}
  
 +</file>
 +
 +===== Capslock on a timer =====
 +<file>
 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 +; --- CapsLock hold-to-enable, tap-to-disable ---
 +
 +CapsLock::
 +    capsHoldTime := 500   ; ms required to enable
 +
 +    ; If already ON → turn OFF immediately
 +    if GetKeyState("CapsLock", "T") {
 +        SetCapsLockState, Off
 +        SoundBeep, 800, 50  ; disable chirp
 +        SoundBeep, 600, 50
 +        return
 +    }
 +
 +    ; Start hold detection
 +    SoundBeep, 600, 40   ; start-of-hold chirp
 +    start := A_TickCount
 +
 +    while GetKeyState("CapsLock", "P") {
 +        if (A_TickCount - start >= capsHoldTime) {
 +            SetCapsLockState, On
 +            SoundBeep, 600, 50   ; enable chirp
 +            SoundBeep, 800, 50
 +
 +            ; --- critical fix ---
 +            KeyWait, CapsLock   ; wait until key is released
 +
 +            return
 +        }
 +        Sleep, 10
 +    }
 +
 +    ; Released early → do nothing
 +return
 </file> </file>
  
autohotkey_recipes.txt · Last modified: by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki