Samsung Book S-PEN Button

Ask gaming related questions (AHK v1.1 and older)
mindcode
Posts: 1
Joined: 19 Mar 2018, 16:12

Samsung Book S-PEN Button

20 Mar 2018, 16:00

Hello there,

currently I'am using AHKHID.ahk and the following script for a game. I map to send the letter i when single press the button. Is it possible to
check also for double press and hold in order to send other letters?

Code: Select all

SendMode Input
SetWorkingDir %A_ScriptDir%

global PEN_NOT_HOVERING := 0x0 ; Pen is moved away from screen.

#include AHKHID.ahk

WM_INPUT := 0xFF
USAGE_PAGE := 13
USAGE := 2

AHKHID_UseConstants()

AHKHID_AddRegister(1)
AHKHID_AddRegister(USAGE_PAGE, USAGE, A_ScriptHwnd, RIDEV_INPUTSINK)
AHKHID_Register()

OnMessage(WM_INPUT, "Work")

Work(wParam, lParam) {

    Local type, inputInfo, inputData, raw, proc
    static lastInput := PEN_NOT_HOVERING

    Critical

    type := AHKHID_GetInputInfo(lParam, II_DEVTYPE)

    if (type = RIM_TYPEHID) {
        inputData := AHKHID_GetInputData(lParam, uData)

    raw := NumGet(uData, 0, "UInt")
        proc := (raw >> 8) & 0x1F
    if (proc <> lastInput) {
        if (proc == 8)
        {
            send i
        }
        lastInput := proc
    }
    }
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: LepG and 65 guests