Skip to content

Instantly share code, notes, and snippets.

@undoZen
Created September 20, 2016 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save undoZen/ce52dd0c67c9bd32077ffcf19fc10b6f to your computer and use it in GitHub Desktop.
Save undoZen/ce52dd0c67c9bd32077ffcf19fc10b6f to your computer and use it in GitHub Desktop.
just map your capslock to esc and apply this script, then you can press capslock to send esc, or hold it to act as ctrl
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*Esc::
if (g_ControlRepeatDetected)
{
return
}
send,{Ctrl down}
g_LastCtrlKeyDownTime := A_TickCount
g_AbortSendEsc := false
g_ControlRepeatDetected := true
return
*Esc Up::
send,{Ctrl up}
g_ControlRepeatDetected := false
if (g_AbortSendEsc)
{
return
}
current_time := A_TickCount
time_elapsed := current_time - g_LastCtrlKeyDownTime
if (time_elapsed <= 250)
{
SendInput {Esc}
}
return
~*^a::
g_AbortSendEsc := true
return
~*^b::
g_AbortSendEsc := true
return
~*^c::
g_AbortSendEsc := true
return
~*^d::
g_AbortSendEsc := true
return
~*^e::
g_AbortSendEsc := true
return
~*^f::
g_AbortSendEsc := true
return
~*^g::
g_AbortSendEsc := true
return
~*^h::
g_AbortSendEsc := true
return
~*^i::
g_AbortSendEsc := true
return
~*^j::
g_AbortSendEsc := true
return
~*^k::
g_AbortSendEsc := true
return
~*^l::
g_AbortSendEsc := true
return
~*^m::
g_AbortSendEsc := true
return
~*^n::
g_AbortSendEsc := true
return
~*^o::
g_AbortSendEsc := true
return
~*^p::
g_AbortSendEsc := true
return
~*^q::
g_AbortSendEsc := true
return
~*^r::
g_AbortSendEsc := true
return
~*^s::
g_AbortSendEsc := true
return
~*^t::
g_AbortSendEsc := true
return
~*^u::
g_AbortSendEsc := true
return
~*^v::
g_AbortSendEsc := true
return
~*^w::
g_AbortSendEsc := true
return
~*^x::
g_AbortSendEsc := true
return
~*^y::
g_AbortSendEsc := true
return
~*^z::
g_AbortSendEsc := true
return
~*^Space::
g_AbortSendEsc := true
return
~*^LShift::
g_AbortSendEsc := true
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment