Skip to content

Instantly share code, notes, and snippets.

@leminhtr
Created June 5, 2024 16:00
Show Gist options
  • Save leminhtr/536c6d45aecfdd60162dbe8fe628a8ff to your computer and use it in GitHub Desktop.
Save leminhtr/536c6d45aecfdd60162dbe8fe628a8ff to your computer and use it in GitHub Desktop.
double/triple caps to pick autocomplete option (Windows)
$CapsLock::
if winc_presses > 0 ; SetTimer already started, so log keypress instead
{
winc_presses += 1
Return
}
; Else, this is first press of a new series. Set count to 1 and start timer
winc_presses = 1
SetTimer, CapsLock, 600 ; Wait for more presses. 400 ms is too short
Return
CapsLock:
SetTimer, CapsLock, off
if winc_presses = 1 ; The key was pressed once
{
;Send, {CapsLock}
; sendInput {CapsLock}
; Switch caps manually since above does not work
GetKeyState, CapsState, CapsLock, T
if CapsState = U
{
SetCapsLockState, AlwaysOn
}
else {
SetCapsLockState, AlwaysOff
}
}
Else if winc_presses = 2 ; The key was pressed twice
{
Send, {Up}{Enter}
}
Else if winc_presses = 3 ; The key was pressed thrice
{
Send {Up}{Right}{Enter}
}
Else if winc_presses = 4 ; The key was pressed thrice
{
Send {Up}{Right}{Right}{Enter}
}
;Else
; {
; Send, {CapsLock}
; winc_presses = 0
; }
winc_presses = 0
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment