module

AutoClick::InputStructure

Windows INPUT structure definitions for AutoClick

This module provides Crystal structs that match the Windows INPUT structure used by the SendInput API for mouse and keyboard events.

Constants

INPUT_HARDWARE = 2_u32
INPUT_KEYBOARD = 1_u32
INPUT_MOUSE = 0_u32

Input types

KEYEVENTF_EXTENDEDKEY = 1_u32

Keyboard event flags

KEYEVENTF_KEYUP = 2_u32
KEYEVENTF_SCANCODE = 8_u32
KEYEVENTF_UNICODE = 4_u32
MOUSEEVENTF_ABSOLUTE = 32768_u32
MOUSEEVENTF_HWHEEL = 4096_u32
MOUSEEVENTF_LEFTDOWN = 2_u32
MOUSEEVENTF_LEFTUP = 4_u32
MOUSEEVENTF_MIDDLEDOWN = 32_u32
MOUSEEVENTF_MIDDLEUP = 64_u32
MOUSEEVENTF_MOVE = 1_u32

Mouse event flags

MOUSEEVENTF_RIGHTDOWN = 8_u32
MOUSEEVENTF_RIGHTUP = 16_u32
MOUSEEVENTF_WHEEL = 2048_u32
MOUSEEVENTF_XDOWN = 128_u32
MOUSEEVENTF_XUP = 256_u32

Instance methods

key_down_input(vk : UInt16) : Bytes
Source
key_up_input(vk : UInt16) : Bytes
Source
keyboard_input(vk : UInt16, scan : UInt16 = 0_u16, flags : UInt32 = 0_u32, time : UInt32 = 0_u32, extra_info : UInt64 = 0_u64) : Bytes

Create keyboard input structure

  • vk: Virtual key code
  • scan: Hardware scan code
  • flags: Keyboard event flags
  • time: Timestamp (0 for system time)
  • extra_info: Additional info
Source
left_down_input
Source
left_up_input
Source
middle_down_input
Source
middle_up_input
Source
mouse_input(dx : Int32, dy : Int32, mouse_data : UInt32, dw_flags : UInt32, time : UInt32 = 0_u32, extra_info : UInt64 = 0_u64) : Bytes

Create mouse input structure

  • dx: X movement or absolute position
  • dy: Y movement or absolute position
  • mouse_data: Additional mouse data (wheel delta, etc.)
  • dw_flags: Mouse event flags
  • time: Timestamp (0 for system time)
  • extra_info: Additional info
Source
right_down_input
Source
right_up_input
Source
send_multiple_inputs(inputs : Array(Bytes)) : UInt32

Send multiple input events

  • inputs: Array of input structure bytes
Source
send_single_input(input : Bytes) : UInt32

Send a single input event

  • input: Input structure bytes
Source
wheel_input(delta : Int32) : Bytes
Source