Configured keyboard not doing anything..?
Hi there! First of all, I hope you are well! I apologize in advance if this is confusing. I will clarify anything necessary.
I use win10 and AHKv2. I have 3 identical numberpads that I used to use HID macros with, but sometimes HID macros was too slow and would transmit the actual number instead.
- I have all 3 correctly configured and numbered 1-3 with Multi keyboard for AHK, but I've been having trouble getting the example script to work. After much troubleshooting, I finally got AHK to stop saying I had an error. I know that was user error. Now, it just doesn't do anything. The msgbox command doesn't do anything so I used send "test message", an example i knew worked on my main (100% keyboard) numberpad. It sent "test message" correctly when I tried that, with Multi keyboard for autohotkey off.
With your program on, it just doesn't do anything. When hitting any external numpad key it doesn't even put in an unprogrammed number.
Any and all advice would be appreciated, I'm new to both scripting and this program. I tried autohotinterception a few years ago, but couldn't get that to work either. I have about 40 shortcuts I'd like to use regularly... I suppose I could just get a cheap 60% keyboard that supports remapping if this doesn't work with these particular numpads.
This is the code in my notepad++ AHK script file.
#Requires AutoHotkey v2.0
OnUniqueKeyboard(KeyboardNumber, VKeyCode, IsDown, WasDown, IsExtended, LeftCtrl, RightCtrl, LeftAlt, RightAlt, Shift) { ; Test message generated on unique configured keyboard, remove after your sure that it is working fine ;MsgBox "Keyboard: " KeyboardNumber "
nKey: " VKeyCode "nIsDown: " (IsDown ? "yes" : "no") "nWasDown: " (WasDown ? "yes" : "no") "nIsExtended: " (IsExtended ? "yes" : "no") "nLeftCtrl: " (LeftCtrl ? "yes" : "no") "nRightCtrl: " (RightCtrl ? "yes" : "no") "nLeftAlt: " (LeftAlt ? "yes" : "no") "nRightAlt: " (RightAlt ? "yes" : "no") "`nShift: " (Shift ? "yes" : "no"); example, remove, keyboard 1 - "0" key if (KeyboardNumber = 3 && VKeyCode = 96 ) Send "Test message"
; ---> Add your code below <--- }
Hi, First of all I do not use v2 AHK but I think I will still be able to help a bit. I see few problem:
- I think you are not using the newest version because I see the line "#Requires AutoHotkey v2.0" which was my mistake and I fixed that later, this should be a comment in script but I used wrong comment character "#" istead of ";"
- Second, Im not sure if you are showing whole script or only part of it, if it is whole script then it is missing functions that should not be modified for example this part:
; do not modify
OnMessage(1325, MsgFunc)
return
; do not modify
MsgFunc(wParam, lParam, msg, hwnd)
{
OnUniqueKeyboard(wParam, lParam & 0xFF, (lParam & 0x100) > 0, (lParam & 0x200) > 0, (lParam & 0x400) > 0, (lParam & 0x800) > 0, (lParam & 0x1000) > 0, (lParam & 0x2000) > 0, (lParam & 0x4000) > 0, (lParam & 0x8000) > 0)
}
Start with the example script once again and only modify stuff inside OnUniqueKeyboard
- Code that you provided will only show up when you press key with code 96 on keyboard 3, for testing try this instead:
if (KeyboardNumber = 3)
MsgBox "Keyboard: " KeyboardNumber "`nKey: " VKeyCode "`nIsDown: " (IsDown ? "yes" : "no") "`nWasDown: " (WasDown ? "yes" : "no") "`nIsExtended: " (IsExtended ? "yes" : "no") "`nLeftCtrl: " (LeftCtrl ? "yes" : "no") "`nRightCtrl: " (RightCtrl ? "yes" : "no") "`nLeftAlt: " (LeftAlt ? "yes" : "no") "`nRightAlt: " (RightAlt ? "yes" : "no") "`nShift: " (Shift ? "yes" : "no")
This code should show message on any key from keyboard 3 and display its code.
I hope its helpful enough for you to figure that now :)