09-24-2005, 01:38 PM
To use a variable with the key command, enclose it in parentheses. Don't forget to leave a space between. If it is string variable, it will be typed as text. If it is integer variable, it is interpreted as virtual-key code, and that key will be pressed. You cannot directly use a variable containing QM key codes, but QM 2.1.7 has functions QmKeyCodeFromVK and QmKeyCodeToVK to convert between virual-key codes and QM key codes. There is a table of virtual-key codes in the Help, or you can use the Keys dialog to get virtual-key constants (VK_...).
Examples:
Type string variable as text:
str a
a="F10"
key (a)
Press F10 using integer variable:
int vk=VK_F10
key (vk)
Press F10 using string variable:
str a
a="F10"
int vk
QmKeyCodeToVK(a &vk)
key (vk)
Examples:
Type string variable as text:
str a
a="F10"
key (a)
Press F10 using integer variable:
int vk=VK_F10
key (vk)
Press F10 using string variable:
str a
a="F10"
int vk
QmKeyCodeToVK(a &vk)
key (vk)