Autohotkey support for Human Interface Devices


Most remote controls with a USB-receiver are HID-devices. You are not able to "catch" the keys in an application without special support for them.

Autohotkey is able to send the desired keys to my software-dvd-player to control it, but wasn't able to catch the remote control signals.

If you want signals from such an HID (human interface device) you have to register the device inside your application. If done, the OS sends your application WM_INPUT-messages you have to interpret. You also get a pointer to a huge struct. The data of the struct depends on the type of the device.

It is a great job to interpret the struct in an autohotkeyscript byte by byte. So I decided to write a little DLL which interprets the received values and passes them more understandable for autohotkey scripts.

To use the Dll and scripts, you have to use Windows XP, because the Windows API only exists there :-(

You can download the archive with :


Usage:
Download the Archive and the first script to the same folder and start "AutoHotkeyRemoteControlDLL.ahk"
Screenshot of the sample application You can see a list of all devices Windows knows. To register a device, select an entry and press the "Register"-button. If you can't see "your" remote control it is not recognized as HID-device by the OS and this dll can't help you. Sorry.
If you don't know, which device is your remote control, try to register all entries one by one and press a key on your remote control to see, if it is recognized.

At the bottom of the window you can see the number of the device which sent a key, the size of the data received and a list of "numbers". These numbers are the values which are generated from the remote control. My remote control sends a message when pressing (03 - 80 - 00) and one when releasing (03 - 00 - 0) a button.

You can also register a keyboard or a mouse. Mice are a little tricky. You do NOT receive the coordinates of the mouse on the screen, but the difference in pixel between the old and the new position. If you move your mouse 4 pixel down, you'll get the message "4". If you move your mouse 4 pixel up, you'll get the msg "-4"!

Try to play a little bit with this example-script to get a feeling for the values you can receive.
Remember also that you can't DEregister a device! If you have registered all devices and you don't know, which device generates a special message, close the script and start from the beginning :-)
Now try to write a script for your own device. The second script (RemoteControl.ahk) can be used as a template for your own script. I've tried to write a lot of comments to help you to find the right places for your changes.



If you have questions, problems, ideas, error or something else, please feel free to send me a message
Last change: 27.08.07


Zähler