Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Key and variable
#1
how do I use a variable with the KEY command

right now I have

str Button

ifk(f10) button = "f10"

key "button"

what do i put instead of "button" with key?
#2
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)


Forum Jump:


Users browsing this thread: 1 Guest(s)