Mapping a 2nd Keyboard for macros (USB & bluetooth)

After playing with AHK scripts I ended with a lot of scripts and nothing to map them to as the easily memorised and handy left keys that my hand can access are all used up.

I ended with AHK Command Picker and that has alleviated some of the stress of having macro’s handy, but it only goes so far. You have to tap CapsLock key then type the Fastkey that you want, a lot of mine have filled up the obvious ones so now I’m having 2 digit for easily finding the ones I want, so I have to tap 3 keys now to get to what I want.

A couple of videos I’ve seen for Gamers who use a 2nd keyboard for macro’s usually a little numberpad and have macros attached to those keys. So I thought I’d explore that process. I’m using evilC / AutoHotInterception process to do this.

Other processes

There are a few programs out there, one HID Macros (This video https://www.youtube.com/watch?v=Oqmt6zUvCVw) and this link http://www.hidmacros.eu but what you download is different form what the website says. Apparently its old.

Another was Multi-keyboard-Macro’s for $29 (https://mediachance.com/multikeyboard/)- But not free so I thought I’d try other ways first.

Another was Multi-keyboard-remapper (don’t download from this site (Trojans)-https://steveh2112.wixsite.com/multi-keyboard-remap) but you can from Sonic or other download sites and it seems OK. But no clear instructions on how to re-map hotkeys, so I left it.

Setup

I cocked up the instruction from the evilC site but finally figured out what to do. The instructions are there, its just I was copying wrong files from wrong zip file (make sure you unblock prior to extracting.

Keyboards and mouses

I’ve been playing with gaming mouses. KMart were selling 7 button gaming mice for $16 so I thought I’d give them a try. I’ve got use to bluetooth mice but thought, as I’m on a Surface Book with a couple of USB ports, I could afford to try the USB option again and I’ve been enjoying adding extra features to the mouse, although I promptly forget what I’d mapped to the new buttons. I’m still trying to figure that out.

I’d considered using a 2nd keypad as that would be handy for developing AHK scripts for Revit and other programs.

I’d initially thought about getting a number keypad to practice on but realised that I had a 2nd keyboard (for my planned server) and also used for Raspberry Pi too. Both I’ve tinkered with but not that far. I also had a Surface book screen with no keyboard and found a bluetooth keyboard for it, it works fine. This is the issue with Surface Book, when Keyboard goes you can only connect to it by wifi as there are no ports in the tablet part, and charger is on the bottom, not the best design for redundancy.

Anyway, I have a wired & a bluetooth keyboard and wanted to see if evilC / AutoHotInterception would work on them.

It does. You use the monitor.ahk script which will go and find what devices you have attached, so you can test them and coy the VID/PID or the Handle depending on the device (see below) :

For the wired keyboard you need to use (AHI.GetKeyboardId())

#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

keyboardId := AHI.GetKeyboardId(0x04D9, 0x1503)
AHI.SubscribeKey(keyboardId, GetKeySC("1"), true, Func("KeyEvent"))
return

For the wireless keyboard you need to use (AHI.GetKeyboardIdFromHandle()), and in that case the “\” causes trouble so you have to put the whole handle in “” quotes and then assign a variable to it, then call the variable

#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()
ax:= "HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&0220&Col01"
keyboardId := AHI.GetKeyboardIdFromHandle(ax)
AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))

return

End comment

So I’ve now been able to connect a couple of Keyboards to my Laptop and run a scrip

t from the key from the 2nd keyboard. That is great. Now I can start thinking about how I’ll set that up and use it and in what programs I’d use it in.

I can see some keys being useful for Firefox tabbing (although there may be a more efficient Hotkey method for that) as I’m not particularly productive in web browsers and need to be more effective in future.

I will write another article when I’ve got some macro’s up and running.