Can I assign multimedia keys to run AHK code?
Seems simple and straight forward?
Would I use AHK Spy to figure out what the button pressed?
Some guidance here would be great
Sometime ago I had the great idea of buying a USB keypad with buttons and assigning them the AHK scripts.
Alas... I found out this is NOT straight forward at all. It's a mission to be able to identify specific key strokes and involves either using bespoke code that comes with the USB device and/or using other Windows drivers and/or using 100's of lines of AHK code written by others...
Have I got that wrong?
Or has it changed with V2 of AHK?
EDIT I did some research and there seems to be loads of sellers of these keypads now.
See pic below for example:
Some (not all) come with software allowing you to map keys.
Thanks.
Can you re-assign multimedia keys?
Re: Can you re-assign multimedia keys?
Generally, yes, it's very straightforward.
No, you would check the KeyHistory of any simple AHK script to see the key presses that it recognized since the script started.
It would only take one line of code per key to run an AHK script at the press of a key, as long as the keypresses are recognizable, which they should be and would be verified by the KeyHistory. If those keypresses are not distinguishable from other keys on the main keyboard and you want them to be, then yes, that's when you'd need to use something like AutoHotInterception. I don't see why the number of lines of code that evilC has already written is a drawback. It's not like you have to write them again.omar wrote: ↑ Alas... I found out this is NOT straight forward at all. It's a mission to be able to identify specific key strokes and involves either using bespoke code that comes with the USB device and/or using other Windows drivers and/or using 100's of lines of AHK code written by others...
Have I got that wrong?
For such devices, it's easy to have it send a key combination that would make it unique relative to anything you might press on your main keyboard, and then you would have your AHK script define those hotkeys to run the AHK script of choice when that key combination is pressed without having to use something like AutoHotInterception. Your AHK script becomes trivially easy.
Re: Can you re-assign multimedia keys?
Amazing reply
That's really helpful
One thing I'm wary of is that these units come with their own bespoke software freshly made in China
If I can use AHK... then I'll opt for that instead
That's really helpful
One thing I'm wary of is that these units come with their own bespoke software freshly made in China
If I can use AHK... then I'll opt for that instead
Re: Can you re-assign multimedia keys?
Well, as I suggested, it may be to your advantage to use their software to have the keys send a key combination you wouldn’t press on your own so then you can be confident that your AHK script is receiving key presses from that keyboard. I do that with foot pedals so they send something like Shift+Ctrl+F7, which I would never press myself, and my script sets a +^F7:: hotkey. However, I did waste money on a couple cheap Chinese foot pedals that had a short life before ending up with a set of much more robust and reliable pedals from a US company. It was well worth the price.