What Pfeil described works here. I have it with a command that executes when I press x. When caps lock is on, it does one thing. If caps lock is not on it does another thing.
If you are wanting the Shift key to come BEFORE the key press, you're going to need to do two things. First, you'll need to set your, 'when i press key' to no allow the key to be passed through. Next, you'll want to put the key you want to press in the macro itself. Otherwise the key will be either be not handled and passed through (as a lower-cased letter) or, not passed through at all:
Begin Text Compare : [{CAPSLOCKON}] Equals '1'
Press X key and hold for 0.1 seconds and release
Else
Press Left Shift+X keys and hold for 0.1 seconds and release
End Condition
Either way, it makes sure, 'X' is capitalized.