# Windows – How to mouse events be caught in Windows when using Magic Trackpad

I have been trying to figure out how to "catch" three and four finger swipes from a trackpad to bind custom keyboard commands to them. I think also tap-to-click could be disabled in the same way.

My idea was to use Autohotkey to catch the signal and bind an action (or unaction) to that mouse input. The problem is that the default driver will not pass this info to the system.

Does anyone know how to get raw-input from the system to the mouse signals for Autohotkey in Windows? Some application, DLL, something else?

These codes are from default Autohotkey that I was able to catch from Magic Trackpad:

VK  SC  Type    Up/Dn   Elapsed Key
02  000     d   1.22    RButton
02  000     u   0.00    RButton
9E  001     d   2.15    WheelDown
9E  001     d   0.03    WheelDown
9F  001     d   1.22    WheelUp
9F  001     d   0.02    WheelUp
9D  001     d   1.83    WheelRight
9D  001     d   0.00    WheelRight
9C  001     d   1.22    WheelLeft
9C  001     d   0.02    WheelLeft


Using the above WheelLeft function I created Back-button for two finger swipe using the following function in Autohotkey:

WheelLeft::
winc_presses = 1
SetTimer, Whleft, 400 ; Wait for more presses within a 400 millisecond window.
return

Whleft:
SetTimer, Whleft, off ; Disable timer after first time its called.
if winc_presses >= 1 ; The key was pressed once or more.
{
SendInput, !{Left} ; Send alt + left for back button (in Chrome at least)
}
; Regardless of which action above was triggered, reset the count to prepare for the next series of presses:
winc_presses = 0
return


The 400 ms delay is used because sweeping causes several WheelLefts to be sent to the computer. This catches only the first of them during the 400 ms. We don't want to send the back command several times. Check out uberoptions.net for a similar solution that has been done for Logitech MX1000.

So, does anyone know how to get other gestures from Magic Trackpad, so we could use it properly in Windows?