Can Autohotkey Remap Media Key Combos?

830 Views Asked by At

I want to use the 4 buttons above the numpad for data entry, with the "calc" button as a sort of modifier, so I can do multiple things with them. I'm having trouble making key combos work.

Here are a few different versions of the code I've tried, to get a way to type the "(" character, but none of these work.

Launch_App2 & Volume_Down:: (              ;- fails
Launch_App2 & Volume_Down::SendInput, (    ;- fails
vkB7 & vkAE::SendInput, (                  ;- fails
SC121 & SC12E::SendInput, (                ;- fails

Here's some more information about the individual keys.

; row above numpad, from left to right
; VK    SC    Type  Key   
; ----------------------------------
; AD    120   a     Volume_Mute
; AE    12E   a     Volume_Down  
; AF    130   a     Volume_Up 
; B7    121   a     Launch_App2    

What I can do however is to remap any one of those keys individually, for example with Volume_Mute:: Esc but I don't seem able to combine them using &. How can I use the keys in combination? I'm using the latest versions of AutoHotKey and Windows 10.

1

There are 1 best solutions below

2
On

There is certainly a problem with media keys on USB keyboards that doesn't happen on ps2 ports, and it involves the keyboard hook (which undoubtedly you are using with other hotkeys). https://autohotkey.com/board/topic/85889-issues-with-keywait-media-play-pause/

Maybe try something like this to get the quasi-combination you want:

SC121:: ; 121 is Logitech Calc key (use your key's value).
      KeyWait, sc110, D L ; 110 is the Logitech media-back key
      MsgBox, %A_ThisHotkey% was pressed. ; SC121
return

So now, if you press the Calc button, nothing happens until you release it and then press the media-back key. That's when you will see the message box. You can also press and hold the Calc key, then press and hold the media-back key and release the Calc key to get the MsgBox.

Hth,