2

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.

Dylan Kinnett
  • 241
  • 3
  • 15
  • I read in a similar conversation that 'A special key can't be combined with another special or modifier key." but the suggested workaround for that didn't work for me either. (source: https://autohotkey.com/board/topic/103748-help-please-with-remap-fnpgup-to-home-on-thinkpad/?p=639524 ) – Dylan Kinnett Aug 10 '20 at 18:57
  • I found another possibly related conversation about how AutoHotkey doesn't seem to recognize the physical state of media keys, using USB keyboards. https://autohotkey.com/board/topic/30842-physical-state-of-media-keys-not-detected-by-getkeystate/ – Dylan Kinnett Aug 10 '20 at 19:29

1 Answers1

0

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,

PGilm
  • 2,262
  • 1
  • 14
  • 26
  • 1
    I was able to tweak and use your example, @PGilm . It works, but pressing that second key (110 in your example) fires off its original function. Is there a way to prevent that? – Dylan Kinnett Aug 15 '20 at 00:45
  • OK, @dylan-kinnett you're on your way, then! Just make a separate hotkey for the second key and have it check the `keystate` of the first (`Calc` button in example) and do nothing if it is down, and otherwise, if it is not down, let it pass through the original function (and remember the `$` modifier so sending it doesn't trigger itself!). Enjoy. – PGilm Aug 18 '20 at 22:40