0

I am trying to create a, what I call, 'Task Switcher' macro, ideally using the useless for me 'Media Play/Pause' button on my 'Microsoft Natural Ergonomic 4000' keyboard. I have no need for the default features of this button and as such I want to rebind it. My most necessary macro is, as I mentioned, Ctrl+Alt+Tab (or Alt+Tab).

I have used the latest Microsoft Mouse and Keyboard Center program to perform this rebind with no success. You can see that below: enter image description here I believe I am doing everything correct; unfortunately there may be a bug with the Tab key in this program and I cannot find a way to circumvent it (I tried other keys of the keyboard too; Alt+Tab won't work). I also tried to increase the delay up to 200ms but it still won't work. I tried the 'Toggle' and the 'Press and Hold' modes as well and nothing.

Then I tried to use the trusty AutoHotkey to intercept the 'Media Play/Pause' button press, get its scancode and then assign it to the Alt+Ctrl+Tab macro, which works just fine in AHK (Send, ^!{TAB}). However when I record keystrokes Autohotkey doesn't recognize the scancode for the 'Media Play/Pause' button (highlighted in blue in the picture above), or any other special buttons from this keyboard for that matter. I believe this is because a special button like this is mapped to a custom HID input device and trying to figure this out would lead to a rabbit hole that goes too deep that I can bother with right now.

Does anybody know how I can assign the Ctrl+Alt+Tab macro/hotkey to a special button of this Keyboard? If you do, kindly share. Thank you.

Edit

Solved by user3419297 here.

Jackdaw
  • 1,222
KeyC0de
  • 229

1 Answers1

1

Using exactly the same keyboard model, I can easily re-map ⏵/⏸ (Play/Pause) button in AutoHotKey like this:

Media_Play_Pause::Send ^!{Tab}
+Media_Play_Pause::Media_Stop
^Media_Play_Pause::Launch_Media

...and your Ctrl+Alt+Tab idea works nicely. So does the rest of examples where I am demonstrating use of Shift and Ctrl modifiers.

But I admit I do not have Microsoft Mouse and Keyboard Center installed to avoid any interference (and to save some system resources).

For sake of completeness of this answer, I need to note that I am using the following modification to Send mode at the top of the AHK script:

SendMode Input

And make sure that you always run the AHK elevated (i. e. As Administrator).

I verified that the following script catches ⏵/⏸ (Play/Pause) button nicely in Windows 10, AHK (version 1.1.25.01) running elevated:

SendMode Input
+Media_Play_Pause::msgbox Shift+PlayPause
^Media_Play_Pause::msgbox Ctrl+PlayPause
Media_Play_Pause::msgbox PlayPause

After your further research, the problem was not in capturing ⏵/⏸ (Play/Pause) button but in executing of Alt+Tab which needed special technique for Windows 8.1. Capture itself went just fine.

miroxlav
  • 13,533
  • Thanks for the help. Unfortunately this doesn't work for me (with/without SendMode Input). I tried various combinations. I wonder why is this.. Have you found the other codes in AHK for the special buttons of this keyboard, like Media_Play_Pause (particularly the Favorites button)? I was trying to record these keys and none appeared in the AHK recorder. – KeyC0de Mar 05 '20 at 01:09
  • Answer updated, the AHK must run elevated. If even that won't help, start switching off interfering software until it starts working. – miroxlav Mar 05 '20 at 09:42
  • Yup, I always run them elevated. Idk what software could interfere other than MS M&K. But I even disabled that key on there (I've done this with other keys). Yeah, it's not going to be that easy to solve this one. – KeyC0de Mar 05 '20 at 10:26
  • @Nikos – You can do 3 things now: (1) map Send ^!{Tab} to some "innocent" key, e.g. AHK NumPadMult (asterisk key at the num pad) and check if it works. (2) connect your keyboard to another computer (without keyboard drivers) and try the above AHK script there. It should work right away. (Then you can accept this answer.) (3) Then you can return to your computer and start determining what app occupies your keyboard shortcut until you find what was interfering. – miroxlav Mar 05 '20 at 11:54
  • It still doesn't work, no matter which key I use to trigger it. Tried on my laptop too, which is clean, runs the same OS windows 8.1 and it doesn't work there either. There is something going on with Tab. I posted this issue on Microsoft forums too. We'll see if anything can be done about it. I gave you an upvote for the effort. – KeyC0de Mar 05 '20 at 14:11
  • Answer updated with my findings. So you basically say that Play/Pause button works well to trigger an action (for example for AHK command msgbox Hi! it displays the message) but it is AHK command Send ^!{Tab} which has issues regardless from which key you launch it. Correct? That is different from what you wrote the question. Or you face both issues? What do you get if you hang msgbox Hi! to NumPadMult – does it work? – miroxlav Mar 05 '20 at 14:30
  • I am on Windows 8.1. It seems that Windows 8 & 8.1 has an incompatibility or bug with ALT,TABbing and AHK. I literally tried more than 25 scripts. This is the only one that worked and solved the problem. All other alt-tab combos simply failed for me. – KeyC0de Mar 05 '20 at 15:01
  • @Nikos – since your question was about intercepting the Play/Pause button (I quote: However when I record keystrokes Autohotkey doesn't recognize the scancode for the 'Media Play/Pause' button) and that part was solved in the answer, maybe you can accept the answer. – miroxlav Mar 05 '20 at 16:12
  • No. My question was 'How to map CTRL + ALT + TAB to a macro activated from a customizable special key on the Microsoft Natural Ergonomic Keyboard 4000?'. My preferred key for that was the MediaPlayPause button, but not necessarily. But I'll accept the answer eitherway, because it works just fine in non-Windows 8.1 virtual machines I tested. – KeyC0de Mar 05 '20 at 16:16
  • @Nikos – Indeed you needed to make the entire thing to work. But if you read the question as 3rd party viewer (not knowing anything about the actual need), it really looked to be a Play/Pause button question (you even thought about context of HID input devices). – miroxlav Mar 05 '20 at 16:20