An AutoHotkey question.
In general, I would like to see, when CapsLock
is on, pressing one key
would produce Shift
+ key
. My question is almost answered in a SuperUser question here and an AutoHotkey post here.
With the help there, what I can achieve now is
- when
CapsLock
is on, pressinga
would produceA
, and likewise for other letters; - when
CapsLock
is on, pressing1
would produce!
,2
would produce@
, and likewise for other keys with shifted symbols, e.g.-
=
;
The special part of my question is that I want to see this behavior happen with arrow keys.
To be specific:
- when
CapsLock
is on, pressingRight
arrow key would produceShift
+Right
, and likewise forLeft
,Up
, andDown
; - when
CapsLock
is on, pressingCtrl
+Right
would produceCtrl
+Shift
+Right
; - In fact, I have remapped keys with
LAlt & L::Send {Right}
so thatAlt
+L
would produce theRight
arrow key. Now I want to see, whenCapsLock
is on,Alt
+L
would produceShift
+Right
.
For your information, I put a solution by Icarus from AutoHotkey forum here
#SingleInstance Force
Keys := "abcdefghijklmnopqrstuvwxyz1234567890-=[];'\,./"
Loop parse, keys
Hotkey $%A_LoopField%, PressKey
Return
PressKey:
StringReplace ThisHotkey, A_ThisHotkey, $
If( GetKeyState( "CAPSLOCK", "T" ) )
SendInput +%ThisHotkey%
Else
SendInput %ThisHotkey%
Return
ESC::ExitApp
It works for point 1 and point 2, but I do not know how to adapt it for arrow keys for points 3, 4 and 5. I tried appending {Right}
to Keys
in the above script but it won't work.
Any help is highly appreciated!