### SetState Command Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of using the SetState command to turn all subscriptions on or off. Set to false to turn off. ```autohotkey AHI.SetState(false) ``` -------------------------------- ### Direct DLL Communication Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of accessing the AHI instance directly for advanced usage, such as sending synthesized input. ```APIDOC ## Direct DLL Communication Example ### Description Example of accessing the AHI instance directly for advanced usage, such as sending synthesized input. ### Code ```autohotkey AHI := new AutoHotInterception() AHI.Instance.SendMouseMove(...) ``` ``` -------------------------------- ### Direct DLL Interaction Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of directly interacting with the AHI DLL instance for potentially better performance, such as sending mouse movements. ```autohotkey AHI := new AutoHotInterception() AHI.Instance.SendMouseMove(...) ``` -------------------------------- ### SendKeyEvent Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of sending a keyboard key event using AHI.SendKeyEvent. This can be used to transform keys invisibly to the OS. ```AutoHotkey AHI.SendKeyEvent(keyboardId, GetKeySC("a"), 1) ``` -------------------------------- ### GetDeviceId Example (Keyboard) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Find a keyboard device ID using its VID and PID. The instance parameter defaults to 1 if not specified. ```autohotkey AHI.GetDeviceId(false, 0x04F2, 0x0112) ``` -------------------------------- ### AHK v1 SubscribeMouseButtons Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of subscribing to all buttons on a specific mouse using AHK v1. The callback function receives the button code and state. ```AutoHotkey AHI.SubscribeMouseButtons(mouseId, true, Func("MouseButtonEvent")) MOUSEBUTTONEVENT(code, state){ ToolTip % "Mouse Button - Code: " code ", State: " state } ``` -------------------------------- ### SendMouseButtonEvent Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of sending a mouse button event. This function can also send mouse wheel events by adjusting the state parameter. ```AutoHotkey AHI.SendMouseButtonEvent(mouseId, button, state) ``` -------------------------------- ### GetDeviceIdFromHandle Example (Keyboard) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Find a keyboard device ID using its handle. The instance parameter defaults to 1 if not specified. ```autohotkey AHI.GetDeviceIdFromHandle(false, "ACPI\PNP0303") ``` -------------------------------- ### SendMouseMove Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of sending relative mouse movement. X and Y values alter the current position in 'Mickeys', not pixels. ```AutoHotkey AHI.SendMouseMove(mouseId, x, y) ``` -------------------------------- ### AHK v2 SubscribeMouseButtons Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of subscribing to all buttons on a specific mouse using AHK v2. The callback function receives the button code and state. ```AutoHotkey AHI.SubscribeMouseButtons(mouseId, true, MouseButtonEvent) MOUSEBUTTONEVENT(code, state){ ToolTip("Mouse Button - Code: " code ", State: " state) } ``` -------------------------------- ### AHK v1 SubscribeMouseMove Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of subscribing to mouse movement in relative mode using AHK v1. Callbacks receive x and y delta values. ```AutoHotkey AHI.SubscribeMouseMove(mouseId, false, Func("MouseEvent")) MOUSEEVENT(x, y){ [...] } ``` -------------------------------- ### SendMouseButtonEventAbsolute Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of sending a mouse button event at specific coordinates, typically used in absolute mode for devices like graphics tablets. ```AutoHotkey AHI.SendMouseButtonEventAbsolute(mouseId, button, state, x, y) ``` -------------------------------- ### Get List of Available Devices Source: https://github.com/evilc/autohotinterception/blob/master/README.md Retrieves a list of all available input devices. Each device info object contains Id, isMouse, Vid, Pid, and Handle properties. ```autohotkey #include Lib\AutoHotInterception.ahk AHI := new AutoHotInterception() list := AHI.GetDeviceList() for index, deviceInfo in list { ToolTip, % "ID: " deviceInfo.Id ", Mouse: " deviceInfo.isMouse ", VID: " deviceInfo.Vid ", PID: " deviceInfo.Pid ", Handle: " deviceInfo.Handle Sleep, 2000 } ``` -------------------------------- ### AHK v1 SubscribeMouseMoveAbsolute Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of subscribing to mouse movement in absolute mode using AHK v1. Callbacks receive absolute x and y coordinates. ```AutoHotkey AHI.SubscribeMouseMoveAbsolute(mouseId, false, Func("MouseEvent")) MOUSEEVENT(x, y){ [...] } ``` -------------------------------- ### AHK v2 SubscribeMouseMove Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of subscribing to mouse movement in relative mode using AHK v2. Callbacks receive x and y delta values. ```AutoHotkey AHI.SubscribeMouseMove(mouseId, false, MouseEvent) MOUSEEVENT(x, y){ [...] } ``` -------------------------------- ### AHK v2 SubscribeMouseMoveAbsolute Example Source: https://github.com/evilc/autohotinterception/blob/master/README.md Example of subscribing to mouse movement in absolute mode using AHK v2. Callbacks receive absolute x and y coordinates. ```AutoHotkey AHI.SubscribeMouseMoveAbsolute(mouseId, false, MouseEvent) MOUSEEVENT(x, y){ [...] } ``` -------------------------------- ### Initialize AutoHotInterception Library (AHK v2) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Initialize the AutoHotInterception library for AHK v2 by calling the AutoHotInterception constructor. ```autohotkey global AHI := AutoHotInterception() ``` -------------------------------- ### Initialize AutoHotInterception Library (AHK v1) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Initialize the AutoHotInterception library for AHK v1 by creating a new instance of the AutoHotInterception class. ```autohotkey global AHI := new AutoHotInterception() ``` -------------------------------- ### Include AutoHotInterception Library (AHK v1) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Include the AutoHotInterception library for AHK v1 scripts. Use #Persistent to keep the script running. ```autohotkey #Persistent ; (Interception hotkeys do not stop AHK from exiting, so use this) #include Lib\AutoHotInterception.ahk ``` -------------------------------- ### Include AutoHotInterception Library (AHK v2) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Include the AutoHotInterception library for AHK v2 scripts. Use Persistent to keep the script running. ```autohotkey Persistent ; (Interception hotkeys do not stop AHK from exiting, so use this) #include Lib\AutoHotInterception.ahk ``` -------------------------------- ### AHK v2 Initialization Source: https://github.com/evilc/autohotinterception/blob/master/README.md Includes the AutoHotInterception library and initializes the AHI object for AHK v2 scripts. ```APIDOC ## AHK v2 Initialization ### Description Includes the AutoHotInterception library and initializes the AHI object for AHK v2 scripts. ### Code ```autohotkey Persistent ; (Interception hotkeys do not stop AHK from exiting, so use this) #include Lib\AutoHotInterception.ahk global AHI := AutoHotInterception() ``` ``` -------------------------------- ### AHK v1 Initialization Source: https://github.com/evilc/autohotinterception/blob/master/README.md Includes the AutoHotInterception library and initializes the AHI object for AHK v1 scripts. ```APIDOC ## AHK v1 Initialization ### Description Includes the AutoHotInterception library and initializes the AHI object for AHK v1 scripts. ### Code ```autohotkey #Persistent ; (Interception hotkeys do not stop AHK from exiting, so use this) #include Lib\AutoHotInterception.ahk global AHI := new AutoHotInterception() ``` ``` -------------------------------- ### Context Mode Hotkeys - AHK v1 Source: https://github.com/evilc/autohotinterception/blob/master/README.md Sets up hotkeys using Context Mode in AutoHotkey v1. This mode leverages AutoHotkey's context-sensitive hotkeys, supporting only keyboard and mouse buttons. Ensure the AutoHotInterception library is included. ```autohotkey #include Lib\AutoHotInterception.ahk AHI := new AutoHotInterception() keyboard1Id := AHI.GetKeyboardId(0x04F2, 0x0112) cm1 := AHI.CreateContextManager(keyboard1Id) #if cm1.IsActive ; Start the #if block ::aaa::JACKPOT 1:: ToolTip % "KEY DOWN EVENT @ " A_TickCount return 1 up:: ToolTip % "KEY UP EVENT @ " A_TickCount return #if ; Close the #if block ``` -------------------------------- ### Context Mode Hotkeys - AHK v2 Source: https://github.com/evilc/autohotinterception/blob/master/README.md Sets up hotkeys using Context Mode in AutoHotkey v2. This mode leverages AutoHotkey's context-sensitive hotkeys, supporting only keyboard and mouse buttons. Ensure the AutoHotInterception library is included. ```autohotkey #include Lib\AutoHotInterception.ahk AHI := AutoHotInterception() keyboard1Id := AHI.GetKeyboardId(0x04F2, 0x0112) cm1 := AHI.CreateContextManager(keyboard1Id) #HotIf cm1.IsActive ; Start the #if block ::aaa::JACKPOT 1:: { ToolTip("KEY DOWN EVENT @ " A_TickCount) return } 1 up:: { ToolTip("KEY UP EVENT @ " A_TickCount) return } #HotIf ; Close the #if block ``` -------------------------------- ### Send Keyboard Key Event Source: https://github.com/evilc/autohotinterception/blob/master/README.md Sends a keyboard key event (press or release) for a specific keyboard. This can be used to synthesize input. ```APIDOC ## SendKeyEvent ### Description Sends a keyboard key event (press or release) for a specific keyboard. This can be used to synthesize input. ### Method `AHI.SendKeyEvent(, , )` ### Parameters * **keyboardId** (string) - The Interception ID of the keyboard. * **scanCode** (integer) - The Scan Code of the key. * **state** (integer) - `1` for key press, `0` for key release. ### Example ``` AHI.SendKeyEvent(keyboardId, GetKeySC("a"), 1) ``` ### Notes If blocking events and sending synthetic input, the changes are invisible to Windows and applications, and standard hotkeys may not detect the synthetic input. ``` -------------------------------- ### Subscribe to mouse movement (Relative Mode) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Subscribes to mouse movement events in relative mode. Coordinates are delta (change). The callback function receives x and y delta values. ```APIDOC ## SubscribeMouseMove / SubscribeMouseMoveRelative ### Description Subscribes to mouse movement events in relative mode. Coordinates are delta (change). The callback function receives x and y delta values. ### Method `SubscribeMouseMove(, , , )` `SubscribeMouseMoveRelative(, , , )` ### Parameters * **deviceId** (string) - The ID of the mouse device. * **block** (boolean) - Whether to block the event. * **callback** (function) - The function to call when the event occurs. It receives two integers: x and y delta. * **concurrent** (boolean) - Whether to allow concurrent callbacks. ### Warning Subscribing to mouse movement generates a large number of callbacks. Keep callbacks short and efficient to avoid high CPU usage. ### Example (AHK v1) ``` AHI.SubscribeMouseMove(mouseId, false, Func("MouseEvent")) MouseEvent(x, y){ [...] } ``` ### Example (AHK v2) ``` AHI.SubscribeMouseMove(mouseId, false, MouseEvent) MouseEvent(x, y){ [...] } ``` ``` -------------------------------- ### SetState Source: https://github.com/evilc/autohotinterception/blob/master/README.md Turns on or off all subscriptions for the AutoHotInterception library. ```APIDOC ## SetState ### Description Turns on or off all subscriptions (Starts on). `true` turns subscriptions on, `false` turns them off. ### Method Signature `SetState(true|false)` ### Example ```autohotkey AHI.SetState(false) ``` ``` -------------------------------- ### Subscribe to mouse movement (Absolute Mode) Source: https://github.com/evilc/autohotinterception/blob/master/README.md Subscribes to mouse movement events in absolute mode. Coordinates are in the range 0..65535. The callback function receives x and y coordinates. ```APIDOC ## SubscribeMouseMoveAbsolute ### Description Subscribes to mouse movement events in absolute mode. Coordinates are in the range 0..65535. The callback function receives x and y coordinates. ### Method `SubscribeMouseMoveAbsolute(, , , )` ### Parameters * **deviceId** (string) - The ID of the mouse device. * **block** (boolean) - Whether to block the event. * **callback** (function) - The function to call when the event occurs. It receives two integers: x and y coordinates. * **concurrent** (boolean) - Whether to allow concurrent callbacks. ### Example (AHK v1) ``` AHI.SubscribeMouseMoveAbsolute(mouseId, false, Func("MouseEvent")) MouseEvent(x, y){ [...] } ``` ### Example (AHK v2) ``` AHI.SubscribeMouseMoveAbsolute(mouseId, false, MouseEvent) MouseEvent(x, y){ [...] } ``` ``` -------------------------------- ### Subscribe to All Keyboard Keys - AHK v1 Source: https://github.com/evilc/autohotinterception/blob/master/README.md Subscribes to all keys on a specific keyboard in AHK v1. The callback function receives the scancode and state of the pressed key. The 'block' parameter determines if the event is blocked from the OS. ```autohotkey AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent")) KeyEvent(code, state){ ToolTip % "Keyboard Key - Code: " code ", State: " state } ``` -------------------------------- ### Subscribe to All Keyboard Keys - AHK v2 Source: https://github.com/evilc/autohotinterception/blob/master/README.md Subscribes to all keys on a specific keyboard in AHK v2. The callback function receives the scancode and state of the pressed key. The 'block' parameter determines if the event is blocked from the OS. ```autohotkey AHI.SubscribeKeyboard(keyboardId, true, KeyEvent) KeyEvent(code, state){ ToolTip("Keyboard Key - Code: " code ", State: " state) } ``` -------------------------------- ### GetKeyboardId Source: https://github.com/evilc/autohotinterception/blob/master/README.md Retrieves the device ID for a specified keyboard based on its VID, PID, and instance. ```APIDOC ## GetKeyboardId ### Description Retrieves the device ID for a specified keyboard. `VID` and `PID` are the Vendor ID and Product ID. `instance` is an optional parameter to specify which device if multiple have the same VID/PID. ### Method Signature `AHI.GetKeyboardId(, [,])` ### Example ```autohotkey AHI.GetKeyboardId(0x04F2, 0x0112) ``` ``` -------------------------------- ### Subscribe to Specific Keyboard Key - AHK v1 Source: https://github.com/evilc/autohotinterception/blob/master/README.md Subscribes to a specific key on a specific keyboard in AHK v1. The callback function receives the state (0 for released, 1 for pressed). The 'block' parameter determines if the event is blocked from the OS. ```autohotkey AHI.SubscribeKey(keyboardId, GetKeySC("1"), true, Func("KeyEvent")) KeyEvent(state){ ToolTip % "State: " state } ``` -------------------------------- ### Subscribe to all buttons on a specific mouse Source: https://github.com/evilc/autohotinterception/blob/master/README.md Subscribes to events for all buttons on a specific mouse device. The callback function receives the button code and state. ```APIDOC ## SubscribeMouseButtons ### Description Subscribes to events for all buttons on a specific mouse device. The callback function receives the button code and state. ### Method `SubscribeMouseButtons(, , , )` ### Parameters * **deviceId** (string) - The ID of the mouse device. * **block** (boolean) - Whether to block the event. * **callback** (function) - The function to call when the event occurs. It receives the button ID and state. * **concurrent** (boolean) - Whether to allow concurrent callbacks. ### Example (AHK v1) ``` AHI.SubscribeMouseButtons(mouseId, true, Func("MouseButtonEvent")) MouseButtonEvent(code, state){ ToolTip % "Mouse Button - Code: " code ", State: " state } ``` ### Example (AHK v2) ``` AHI.SubscribeMouseButtons(mouseId, true, MouseButtonEvent) MouseButtonEvent(code, state){ ToolTip("Mouse Button - Code: " code ", State: " state) } ``` ``` -------------------------------- ### Send Mouse Button Event Source: https://github.com/evilc/autohotinterception/blob/master/README.md Sends a mouse button event (click or release) for a specific mouse. This can be used to synthesize input. ```APIDOC ## SendMouseButtonEvent ### Description Sends a mouse button event (click or release) for a specific mouse. This can be used to synthesize input. ### Method `AHI.SendMouseButtonEvent(,