Here's the script that triggers keyboard button with tablet button, I've tried to map keys to Button_1, but none of that works, perhaps the script is not fit to work in reverse?
Code: Select all
;Loads the required AHKHID Script
#Include AHKHID.ahk
;Create GUI to receive messages
Gui, +LastFound
hGui := WinExist()
;Intercept WM_INPUT messages
WM_INPUT := 0xFF
OnMessage(WM_INPUT, "InputMsg")
;Register Remote Control with RIDEV_INPUTSINK (so that data is received even in the background)
r := AHKHID_Register(65280, 10, hGui, RIDEV_INPUTSINK)
InputMsg(wParam, lParam)
{
Local devh, iKey, sLabel
Critical
;Get handle of device
devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
;Check for error
If (devh <> -1) ;Check that it is Wacom Graphic Tablet
And (AHKHID_GetDevInfo(devh, DI_DEVTYPE, True) = RIM_TYPEHID)
And (AHKHID_GetDevInfo(devh, DI_HID_VENDORID, True) = 1386)
And (AHKHID_GetDevInfo(devh, DI_HID_PRODUCTID, True) = 855)
And (AHKHID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True) = 291)
{
;Get data
iKey := AHKHID_GetInputData(lParam, uData)
;Check for error
If (iKey <> -1)
{
byte1 := NumGet(uData, 1, "UChar")
byte2 := NumGet(uData, 2, "UChar")
byte3 := NumGet(uData, 3, "UChar")
byte4 := NumGet(uData, 4, "UChar")
sLabel := "UNDEFINED"
If(byte1 = 0x13 And byte2 = 0x64 And byte3 = 0x0 And byte4 = 0x0)
sLabel := "RELEASE"
If(byte1 = 0x11 And byte2 = 0x1 And byte3 = 0x1 And byte4 = 0x0)
sLabel := "Button_1"
If IsLabel(sLabel)
Gosub, %sLabel%
}
}
}
RELEASE: ; Key released event
Return
Button_1: ; Top button 1
SendInput {Enter}
Return