I tried my very first script, which almost works, but not completely.
My goal is to remap a few keyboard keys that I can't access easily with my small hands while typing text. My first script will remap a few keys to behave like the arrow keys.
I don't feel confortable with the actual position of the arrow keys (Up, Down, Left, Right). Since I never use the CapsLock, my idea is to use the CapsLock key to make the keys ijkl behave respectively like Up, Left, Down, Right.
I have two additionnal requirements :
- I want to be able to use the CapsLock key both as a modifier and in lock mode. It means that, if CapsLock is locked, I want the ijkl keys to behave like arrow keys. If CapsLock is not locked, maintaining it down while typing ijkl would also activate the remap.
- I want any other modifier (Shift, Ctrl, Alt, Win) to be preserved. I mean that when I press "CapsLock+Ctrl+i", I would obtain the same result as pressing Ctrl+Up. Similarly, when I press Ctrl+i when CapsLock is locked, I would obtain the same result.
My script almost works except the last point of my requirement : with my current script, when I press Ctrl+i when CapsLock is locked, the key is not remapped. It behaves exactly like a standard Ctrl+i.
Where am I wrong ?
Here is the script :
#SingleInstance Force #UseHook On CapsLock & i:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Up} Else, SendInput {Blind}i Return i:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Up} Else, SendInput {Blind}i Return CapsLock & j:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Left} Else, SendInput {Blind}j Return j:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Left} Else, SendInput {Blind}j Return CapsLock & k:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Down} Else, SendInput {Blind}k Return k:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Down} Else, SendInput {Blind}k Return CapsLock & l:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Right} Else, SendInput {Blind}l Return l:: GetKeyState, CapsLockMode, CapsLock, T IfEqual, CapsLockMode, D, SendInput {Blind}{Right} Else, SendInput {Blind}l Return
[Title edited. Please write descriptive titles for your topics. ~jaco0646]