1
votes

So I wanted to print < when pressing caps lock and > when holding shift and hitting caps lock. For some reason > won't get printed when I use the code below:

CapsLock::
    If GetKeyState("Shift")
    Send, >
    else
    Send, <
Return
2

2 Answers

2
votes

How about this in the same number of lines?

CapsLock::
    Send, <
Return

+CapsLock::
    Send, >
Return

Additionally, if you want to preserve the functionality of Capslock and Shift, add a tilde beforehand:

~CapsLock::
    Send, <
Return

~+CapsLock::
    Send, >
Return
1
votes

In addition to @David's answer which is the correct way to do it, your code doesn't work because you defined CapsLock as a hotkey which means it's not going to fire when shift is pressed. Adding * to your hotkey: *CapsLock:: will make it fire regardless of modifiers and your code will work.