Obviously it's not worth building in something that checks/optionally toggles CAPS Lock for the rare occasions it happens, but you can use Alien to help!
Put this in your Global Lua:
VK_CAPITAL = 0x14
aliencore = alien.core
user32 = aliencore.load("user32.dll")
-- ************ GetKeyState ************
gGetKeyState = user32.GetKeyState
gGetKeyState:types{ ret = 'short', abi = 'stdcall', 'uint' }
function aGetKeyState(VK)
return gGetKeyState(VK)
end
And this in your action:
local iCapsOn = aGetKeyState(VK_CAPITAL) --Get the current state of the CAPS Lock key
if iCapsOn == 1 then --CAPS Lock is on, turn it off
acSendKeys("{CAPSLOCK}")
end
acSendKeys("Hello") --send your keys here
if iCapsOn == 1 then --CAPS Lock was on at the start of this script, so turn it back on
acSendKeys("{CAPSLOCK}")
end
Note that I only tested this for the CAPS Lock key, not the other reasons for calling GetKeyState; just noting in case the function is not ideal for other situations.