mmmax wrote: ↑22 Oct 2020, 06:51
Which app do you use to log all of the key up/down events when pressing a hotkey? Is it AHK that is somehow generating this debug? I've just been using EventGhost with the keyboard plugin to log stuff.
It's AHK's own
KeyHistory (<-- this is a link to the docs). You can either assign a hotkey like
^k::KeyHistory to pull it up, or use your script's
main window - it's usually hidden, but you can bring it up, by double-clicking your scripts tray icon or via 'Open' in its context menu (then choose 'KeyHistory' in the 'View' menu).
It also shows additional information like
s for suspended or
h for hooked, which you can see in the keyhistories above (they are explained in the actual KeyHistory window).
I don't know if EventGhost (or some other program on your computer) interferes with AHK's keyboard hooks, but I rather believe what I see in AHK's own keyboard history (and my own eyes). In the past, it was quite reliable.
Not sure what editor you are using where you are only seeing a 1 being sent. But perhaps try this same thing with Numpad9, which would be a more obvious NumpadPageUp, as I think NumpadEnd will simply place the cursor at the end of the line in a text editor.
I tried
Code: Select all
*Numpad8::
*NumpadUp::Send {Numpad8}
*Numpad9::
*NumpadPgUp::Send {Numpad9}
but the cursor didn't move up once in the editor, like it does, if I normally press
NumpadUp or
NumpadPgUp.
Instead I just get
8s and
9s, the same with modifiers pressed and holding the keys continuously down - no matter, if NumLock is ON or OFF.
Example of the
KeyHistory for
Numlock OFF, pressing
Shift+NumpadPgUp - while running the code above:
Code: Select all
A0 02A d 0.03 LShift
21 049 h d 0.02 NumpadPgUp
A0 02A i u 0.00 LShift
69 049 i d 0.00 Numpad9
69 049 i u 0.02 Numpad9
A0 02A i d 0.01 LShift
21 049 s u 0.08 NumpadPgUp
A0 02A u 1.28 LShift
h stands for hooked,
s for suppressed - so
NumpadPgUp gets blocked and replaced by
Numpad9. The physically held down
LShift gets automatically and temporarily
logically released by
Send to not interfere with sending a plain
Numpad9 (
d and
u stands for down and up), and re-instated to its (d)own state - until I finally release it physically.
At the same time, the editor shows
9 and no jump of the cursor. So the Keyhistory seems to reflect pretty accurately the observable behaviour.
Then, I exited my script, tried the same combo again, and everything was selected from the original cursor position up to the top. So, this default behaviour of my editor was clearly not triggered, when the hotkeys were active.
Also in Notepad: the standard actions for NumLock OFF don't happen, if the script runs.
Also, I'm not sure how you can tell if modifiers are being sent with Numpad1 (e.g. shift+Numpad1) if the output is just text. You'd need to test in something where you can assign keyboard shortcuts to some other function so you could see if it actually is receiving shift+numpad1 instead of NumpadEnd.
In the editor, the Numlock Off keys have their own observable effects, like mentioned above. But in doubt, the keyhistory can tell you what actually happens.
As I understand it,
Windows doesn't really differentiate between
Shift+Numpad1 and
NumpadEnd. It automatically replaces the former with the latter, if you press the former. But I might be wrong
The hotkeys above just send plain
Numpad8 and
Numpad9, that's how
Send works, by default it releases modifiers - that seemed to be what you wanted (" I need the Numpad to work the way it does when using my Mac: like numeric keys, regardless of whether Shift is pressed or not.") So I am still not sure, what the actual problem might be. I can't imagine that Windows or Windows programs expect something else than standard Windows behaviour...
If you have a working AHK script where no other combination of Numpad1 or NumpadEnd is sent before Shift+Numpad1, please send me the code for the script you are using in its entirety (with any other settings, includes, etc) so I can test that in case something else in my AHK script is causing an issue.
I am only using the snippets I showed above.
Perhaps you should describe what your shortcuts in Reaper are actually doing, or meant to do - so that someone can try to reproduce your problem.
(Reaper doesn't see any difference between the normal "End" key and "NumpadEnd", by the way)
You mean their normal effect (which could be expected) or their differentiation for key combos? The latter would sound like a deficiency of Reaper, but I can't imagine that the Reaper developers don't know how the Windows numpad works, or why they would limit the shortcut options for their users. But stranger things happened...
They seem to be the same 'virtual key' (
23) - usually having the same effect (same with the arrow keys), I guess, but for hotkeys they
can be differentiated easily by their scan codes:
04F vs
14F - that's what AHK does:
Code: Select all
23 04F d 4.84 NumpadEnd
23 04F u 0.06 NumpadEnd
23 14F d 2.78 End
23 14F u 0.06 End