GetKeyName / GetKeyVK / GetKeySC [v1.1.01+]
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, bothGetKeyName("vk1B")
andGetKeyName("Esc")
returnEscape
, whileGetKeyVK("Esc")
returns27
. 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)