Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MattC94
Posts: 2
Joined: 08 Feb 2023, 07:02

Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Post by MattC94 » 08 Feb 2023, 07:12

Hello all,
I'm hoping someone can help with something I've been scratching my head over.
I have a bluetooth connected numpad keyboard (because the laptop I have from work doesn't have a numpad on its keyboard) and it has a fairly redundant (for me) "=" button which I'd like to remap to input a tab.

I've captured what happens when I press the "=" key on my 3rd party BT numpad and the below lines fire (between the F5s if you can see the attachment).
image.png
image.png (22.03 KiB) Viewed 405 times
LAlt (down)
NumpadRight (down)
NumpadEnd (down)
NumpadRight (up)
NumpadEnd (up)
LAlt (up)

... How do I bind this sequence to fire the tab key? I've tried the below hotsrting to no avail:

Code: Select all

:*:LAltNumpadRightNumpadEnd::Tab
This, naturally, resulted in each key alternating downstrokes and upstrokes, rather than simulating the above.
Does anyone know how to tap into this?

Thanks in advance,
Matt.
Attachments
image.png
image.png (22.03 KiB) Viewed 405 times

User avatar
boiler
Posts: 16973
Joined: 21 Dec 2014, 02:44

Re: Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Post by boiler » 08 Feb 2023, 07:38

MattC94 wrote: ... How do I bind this sequence to fire the tab key? I've tried the below hotsrting to no avail:

Code: Select all

:*:LAltNumpadRightNumpadEnd::Tab
This, naturally, resulted in each key alternating downstrokes and upstrokes, rather than simulating the above.
Huh? This would have done nothing like what you describe. That’s not how hotstrings work. It would only be activated if you typed the part on the left as text, not the keys they describe or your = key, to produce the word “Tab” (not the Tab key).

In other words, it has nothing to do with pressing the = sign on your keyboard, so whatever result you saw when you pressed that is the same as you would have gotten without the above hotstring active.

RussF
Posts: 1269
Joined: 05 Aug 2021, 06:36

Re: Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Post by RussF » 08 Feb 2023, 07:56

@boiler, I was playing with this, but haven't come up with a solution yet.

You know how you can create non-typeable characters by holding down the Alt key while typing a number on the numeric keypad (NumLock state doesn't matter)? It would appear that the OP's external keypad is sending Alt-6-1 instead of the actual = key. Try it in Notepad - Hold Alt down while typing 6 (Right arrow) 1 (End) then release the Alt key. You will get the = character. I haven't yet figured out how to trap that. Perhaps your much more extensive knowledge of AHK will help?

Russ

User avatar
boiler
Posts: 16973
Joined: 21 Dec 2014, 02:44

Re: Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Post by boiler » 08 Feb 2023, 08:07

That makes sense. There may be a way to do that. I don’t know. What I would try is setting a hotkey based on part of the key combination it says is being sent. So I would try this:

Code: Select all

!NumpadRight::Send, {Tab}
or maybe:

Code: Select all

!Numpad6::Send, {Tab}

MattC94
Posts: 2
Joined: 08 Feb 2023, 07:02

Re: Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Post by MattC94 » 10 Feb 2023, 06:13

Interesting! So, I tried

Code: Select all

! & Numpad6 & Numpad1::Tab
and it complained that it was an invalid hotkey, which is a shame.

I have found that it recognises the numpad keys individually as numpad2, numpad4, etc. while I was mucking about which might help.

User avatar
boiler
Posts: 16973
Joined: 21 Dec 2014, 02:44

Re: Mapping from BT Keyboard where the KeybdHook shows a string of keystrokes tied to a single button

Post by boiler » 10 Feb 2023, 07:28

! is not the name of the key. That’s only for when Alt is used as a modifier. It would be LAlt when used in a custom combination, which is limited to two keys. The key sequence isn’t all three keys together anyway. It’s Alt down, 6 (down and released), then 1, Alt up.

Post Reply

Return to “Ask for Help (v1)”