VKnnSCnnn and SCnnnVKnn are not valid for hotkeys, hence not being on the key list page.
AutoHotkey's keyboard hook handles each key either by virtual keycode or by scancode, not both. Home (sc147) is always handled by scancode. NumpadHome/Numpad7 is handled by virtual keycode by default, but the presence of a hotkey which lacks a virtual keycode (i.e.
sc47::) can override this. For example:
Code: Select all
$vk24::msgbox ; Does not work unless sc47:: is removed.
#if false ; The hotkey does not have to be active.
sc47::return ; The presence of this hotkey changes the handling of key sc47.
NumpadHome:: is equivalent to
$vk24::. Since the hook handles Home by scan code, it is never triggered by pressing Home.
vk24:: (without $) may be implemented with the "reg" method, in which case a hotkey is registered with the system by vk, and the system notifies us whenever any key with that vk is pressed.
This is by design.
msgbox % GetKeyName("sc45") ; I get Numlock but should be Pause.
This is because Pause is handled by vk - there is no entry for it in the name-to-scancode table - and when we ask
MapVirtualKey which vk corresponds to sc45, it gives us the wrong answer.
msgbox % Format("sc{:x}", GetKeySC("Pause")) ; Shows nothing
This is because when we ask
MapVirtualKey which sc corresponds to VK_PAUSE (vk13), it fails completely. This is probably related to the special nature of the Pause/Break key, which
has been said to produce the scan code e1 1d 45. Although KeyHistory will tell us the scan code is 45, there's probably some truncation happening (possibly before the keyboard hook is called). If we pass the MAPVK_VK_TO_VSC_EX flag MapVirtualKey[Ex] (on Vista or later), it will tell us that the scan code is e1 1d, which is incomplete.
Note that when AutoHotkey shows scan code
1xx, the actual code coming from the keyboard hardware is
e0 xx.
I will get wrong scancode - 030.
Can you guess what the problem is? It's MapVirtualKey again. Usually it doesn't matter, because most programs don't care about the scan code. For the rest, you can work around it by
specifying both vk and sc.
These three issues can be fixed. There are already a bunch of exceptions for other keys which MapVirtualKey does not support.