[error] variable "KEY_0" is not defined


Trying to type numbers using Sendkeys and Xtype but I’m getting this error. This happens for all numbers [0-9] and also for ${KEY_NumX}.


Hi, I confirmed this issue and logged an error - thanks for reporting it!

Workaround: Note that you need the ${KEY_1} notation for standard keys only if you want to combine them with the modifier keys ${KEY_CTRL}, ${KEY_ALT} and ${KEY_SHIFT}, or with special keys like ${KEY_TAB}. “Combine” in this context means: Press 2 or more keys at the same time, like ${KEY_CTRL+KEY_V}.

If you only need to send text, you can just use XType | 1,2,3,...,9 hello world without any special notation for the keys. This even works with non-keyboard characters like “€” or “你好” - hello in Chinese. XType still simulates native keypress events.