GetKeyName/VK/SC()
Retrieves the name/text, virtual key code or scan code of a key.
String := GetKeyName(Key) Number := GetKeyVK(Key) Number := GetKeySC(Key)
Parameters
- Key
A VK or SC code, such as "vkA2" or "sc01D", a combination of both, or a key name. For example, both
GetKeyName("vk1B")
andGetKeyName("Esc")
return "Escape", whileGetKeyVK("Esc")
returns 27. Note that VK and SC codes must be in hexadecimal. To convert a decimal number to the appropriate format, useFormat("vk{:x}", vk_code)
orFormat("sc{:x}", sc_code)
.
Return Value
These functions return a name, virtual key code or scan code of Key.
Related
Examples
; Show information for a specific key. key := "lwin" ; Any key can be used here. name := GetKeyName(key) vk := GetKeyVK(key) sc := GetKeySC(key) MsgBox, % Format("Name:`t{}`nVK:`t{:X}`nSC:`t{:X}", name, vk, sc)