Skip to content

Instantly share code, notes, and snippets.

@ofca
Created January 31, 2012 20:06
Show Gist options
  • Save ofca/1712605 to your computer and use it in GitHub Desktop.
Save ofca/1712605 to your computer and use it in GitHub Desktop.
AutoHotKey script which allow using i, j, k, l as arrows keys when CapsLock in on.
; ----------------------------------------------------------------------------
; j,k,l,i = arrows
; ----------------------------------------------------------------------------
$j::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
Send {Left}
else
Send {j}
return
$l::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
Send {Right}
else
Send {l}
return
$i::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
Send {Up}
else
Send {i}
return
$k::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
Send {Down}
else
Send {k}
return
; ----------------------------------------------------------------------------
; Ctrl + (j,l)
; ----------------------------------------------------------------------------
; Ctrl + j = Ctrl + Arrow Left
$^j::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Ctrl down}{Left}{Ctrl up}
}
else
Send {j}
return
; Ctrl + l = Ctrl + Arrow Right
$^l::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Ctrl down}{Right}{Ctrl up}
}
else
Send {l}
return
; ----------------------------------------------------------------------------
; Shift + (j,k,l,i)
; ----------------------------------------------------------------------------
; Shift + j = Shift + Arrow Left
$+j::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Left}{Shift up}
}
else
Send {J}
return
; Shift + l = Shift + Arrow Right
$+l::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Right}{Shift up}
}
else
Send {L}
return
; Shift + i = Shift + Arrow Up
$+i::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Up}{Shift up}
}
else
Send {I}
return
; Shift + k = Shift + Arrow Down
$+k::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Down}{Shift up}
}
else
Send {K}
return
; ----------------------------------------------------------------------------
; Shift + Ctrl + (j,k,l,i)
; ----------------------------------------------------------------------------
; Shift + Ctrl + j = Shift + Arrow Left
$^+j::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Ctrl down}{Left}{Ctrl up}{Shift up}
}
else
Send {j}
return
; Shift + Ctrl + l = Shift + Arrow Right
$^+l::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Ctrl down}{Right}{Ctrl up}{Shift up}
}
else
Send {l}
return
; Shift + Ctrl + i = Shift + Arrow Up
$^+i::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Ctrl down}{Up}{Ctrl up}{Shift up}
}
else
Send {i}
return
; Shift + Ctrl + k = Shift + Arrow Down
$^+k::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
{
Send {Shift down}{Ctrl down}{Down}{Ctrl up}{Shift up}
}
else
Send {k}
return
; ----------------------------------------------------------------------------
; Mouse wheel emulation
; ----------------------------------------------------------------------------
; o = mouse wheel up
$o::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
Send {WheelUp}
else
Send {o}
return
; u = mouse wheel down
$u::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
if state = D
Send {WheelDown}
else
Send {u}
return
@visualskyrim
Copy link

Excellent!
There is only one problem, though.
If you hold the shift and any of your mapped arrow keys(jikl) for a while, the cursor won't keep selecting.
I guess that's because {Shift up} is sent during the time you hold the keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment