ofca
1/31/2012 - 8:06 PM

AutoHotKey script which allow using i, j, k, l as arrows keys when CapsLock in on.

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