How to make a script for a specific device

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Monota Hiroshi
Posts: 1
Joined: 14 May 2023, 00:41

How to make a script for a specific device

14 May 2023, 00:58

Hi I'm really new to AutoHotkey so i'm having a problem detecting my device.

I've done 3 way to get my device HWID, each have different result but all of them don't work:

-Using Device Manager > Mice and other pointing devices > HID-compliant mouse > Details >> Hardware IDs :

HID\VID_1EA7&PID_0064&REV_0200&Col02
HID\VID_1EA7&PID_0064&Col02
HID\VID_1EA7&UP:0001_U:0002
HID_DEVICE_SYSTEM_MOUSE
HID_DEVICE_UP:0001_U:0002
HID_DEVICE

-Using XMCQCX's DeviceIDFinder.ahk in forum viewtopic.php?style=7&t=108930 :

HID-compliant vendor-defined device:
HID\VID_1EA7&PID_0064&COL01\6&17D9C314&0&0000

HID-compliant mouse:
HID\VID_1EA7&PID_0064&COL02\6&17D9C314&0&0001

USB Input Device:
USB\VID_1EA7&PID_0064\5&1DDC8DB0&0&1

-Using RawInput.ahk GUI:

Type: 0
Page: 1
Usage: 2
Name: \\?\HID#VID_1EA7&PID_0064&Col02#6&17d9c314&0&0001#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

DevType: 0, Handle: 7078275, Param: 0, State: 0x0000, BtnFlags: 0x0000, BtnData: 0x0000, RawBtns: 0x00000000, LastX: 1, LastY: -1, Extra: 0x00000000

My script here:

Code: Select all

; Include the RawInput library
#Include RI.ahk

; Set the device ID of the device you want to monitor
deviceID := "My HWID Here"

; Create a RawInput object for the mouse
mouse := new RawInput("mouse")

; Register a callback function to handle mouse events
mouse.OnEvent(mouseEvent)

; Define the callback function
mouseEvent(device, data)
{
MsgBox Passed!
    ; Check if the event is from the device we want to monitor
    if (device.id == deviceID)
    {
        MsgBox BRUH
        ; Check if the right mouse button was clicked
        if (data.button & RI_MOUSE_RIGHT_BUTTON_DOWN)
        {
            ; Perform an action when the right mouse button is clicked
            MsgBox Right mouse button clicked on device %deviceID%!
        }
    }
}
But the whole mouseEvent don't seem to work.
Can someone help me? :crazy:
Attachments
Test.ahk
(778 Bytes) Downloaded 49 times
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to make a script for a specific device

14 May 2023, 06:03

looks like uve had chatgpt fart some random nonsense out. there is nothing to fix, except deleting everything and starting over

my suggestion would be to look at how rawinput gui is implemented and copypaste from there

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: mikeyww, sergows and 50 guests