Page 1 of 1

Miscellaneous behavior of hotkeys

Posted: 07 Jun 2018, 21:56
by serzh82saratov

Code: Select all

vk26::MsgBox NumpadUp or Up

Code: Select all

#UseHook  

vk26::MsgBox Only NumpadUp

Re: Miscellaneous behavior of hotkeys

Posted: 08 Jun 2018, 01:55
by lexikos
This is a known issue, already documented (see VKnn in the key list), and unlikely to be fixed.

Re: Miscellaneous behavior of hotkeys

Posted: 08 Jun 2018, 03:09
by serzh82saratov

Code: Select all

#UseHook  

#If 0
sc48:: MsgBox will not start, expression is not true
#If

vk26::MsgBox now and NumpadUp does not work

Re: Miscellaneous behavior of hotkeys

Posted: 08 Jun 2018, 03:11
by serzh82saratov
lexikos wrote:This is a known issue, already documented (see VKnn in the key list), and unlikely to be fixed.
it's clear

Re: Miscellaneous behavior of hotkeys

Posted: 09 Jun 2018, 00:08
by lexikos
Also known, also unlikely to be fixed.

It is similar to using Esc and Escape, or Escape and vk1B.
When creating duplicate hotkeys, the order of modifier symbols such as ^!+# does not matter. For example, ^!c is the same as !^c. However, keys must be spelled consistently. For example, Esc is not the same as Escape for this purpose (though the case does not matter).
Source: #IfWin[Not]Active / #IfWin[Not]Exist
Generally speaking, each event may correspond to a hotkey, and only the active variant of that hotkey will execute. sc48 and vk26 are not variants of the same hotkey, but different hotkeys. The event corresponds to one of those hotkeys, and either the active variant of that hotkey is executed, or no hotkey is executed and KeyHistory shows '#'.

Additionally, the hook handles each key either by virtual key code or by scan code, not both. If a hotkey is specified by scan code, all events with that scan code are handled by scan code, not vk. (Also, some keys are handled by scan code by default.) This is regardless of whether the #If expression is true, because the expression can only be evaluated after the event is mapped to a hotkey.

If both hotkeys would be handled by SC (e.g. NumpadEnter and sc11C) or both hotkeys would be handled by VK (e.g. Esc, Escape and vk1B), the first hotkey generally takes precedence.