Skip to content

Instantly share code, notes, and snippets.

@wxk6b1203
Last active November 2, 2023 11:02
Show Gist options
  • Save wxk6b1203/ffa051ffe72296870832951567ce9010 to your computer and use it in GitHub Desktop.
Save wxk6b1203/ffa051ffe72296870832951567ce9010 to your computer and use it in GitHub Desktop.
CapsLock2CtrlSpace
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;SetCapsLockState, AlwaysOff
CapsLock::
If (StartTime)
Return
StartTime := A_TickCount
return
CapsLock Up::
TimeLen := A_TickCount - StartTime
If (TimeLen<1000)
{
If (GetKeyState("CapsLock","T")=1)
SetCapsLockState, Off
Else
Send, {Ctrl down}{Space down}{Ctrl up}{Space up}
}
Else
{
If (GetKeyState("CapsLock","T")=1)
SetCapsLockState, Off
Else
SetCapsLockState, on
}
StartTime := ""
return
!q::
Send, {Alt down}{F4 down}{Alt up}{F4 up}
!BS::
Send, {Shift down}{Home}{Shift up}{BS}
return
!Left::
Send, {Home}
return
!Right::
Send, {End}
return
!+Left::
Send, {Shift Down}{Home}{Shift Up}
Return
!+Right::
Send, {Shift Down}{End}{Shift Up}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment