This is something I had been wanting to do for a very long time! I love to have some extra keypads around my desk to accompany my main keyboard. I usually use them for non standard tasks, such as media keys to control my music or shortcuts in Photoshop.
For a task like this most people would use a tool like autohotkey to program macro scripts like these - and that is fine until... what happens if you have more than one keypad or if your actual keyboard has a keypad too? What if you just want a lot of macro keys? Sadly Autohotkey can not tell the difference between the same keys on multiple keyboards.
Imagine the following situation:
You have a numpad like this and you want to remap its "Tab" key to do something else - for example to mute your audio. You go ahead and write your Autohotkey script and then realize that the script will also trigger when you hit "Tab" on your main keyboard. Duh! No good. Our plan was not to give up keys, but to gain a few extra ones!
The problem is that autohotkey (and all other macro programs I tried) are unable to tell the difference between several connected input devices. This means every key you assign a macro too will also trigger on all of your connected keyboards.
Recently I stumbled upon a little tool called HID macros. Originally written to be used with Flight Simulators, it is actually able to tell apart keystrokes from multiple connected keyboards!
The tool is still pretty unknown and due to its original intention to be used with flight simulators - not very feature rich. The latest beta version allows for some very basic VBScript scripting, but still did not meet my needs. One of the few things that HID Macros can do out of the box is to launch another application. This gave me an idea.HID Macros Website wrote:This small utility is written mainly for Flight Simluator (with extra feature for FSX Deluxe version), but can be also usefull if you want to activate keyboard macros from special keyboard(s). With latest version 1.5 mouse & game devices support was added (see below).
manage multiple keyboards/mouses connected to one PC
different key on different keyboard has assigned it's own command
mouse buttons on different mouses can be also used as macro trigeer - including mouse wheel
when a key activates macro, it's own beahvior (e.g. sending letter code to windows) is deactivated
macro can send another keyboard keys, launch application or send command to FSX via SimConnect
when no macro is assigned, keyboard/mouse works as usual
Outsourcing work is always good!
So, HID Macros lacks a lot of features, but lets us launch other applications. Good enough! NirCmd is another little (60kb) standalone tool that kinda acts like a "swiss army knife" for common computing tasks. It gives you access to a ton of functions and commands by simply passing them to the command line parameter. There are dozens of things you can do with this. Just take a look at the massive list of features and examples. NirCmd has no UI and never spawns any visible window. The process ends as soon as the command was executed, invisible and silent.
The idea is to simply use HID Macros to detect a keypress and have it launch NirCmd with the desired parameters. Check out this little video to give you an idea and conclusion:
So there you have it, full freedom for your extra keypads or even full keyboards!