module AutoClick

Overview

AutoClick - Windows GUI automation library for Crystal

This library provides mouse and keyboard automation capabilities by interfacing with Windows User32 API functions.

Usage:

# Method 1: Include the module
include AutoClick
left_click()
mouse_move(100, 100)
type("Hello World")

# Method 2: Use as namespace
AutoClick.left_click
AutoClick.mouse_move(100, 100)
AutoClick.type("Hello World")

Included Modules

Extended Modules

Defined in:

auto_click.cr
auto_click/user32.cr

Constant Summary

VERSION = "0.5.0"

Instance Method Summary

Instance methods inherited from module AutoClick::Keyboard

alt_f4 : Nil alt_f4, alt_tab : Nil alt_tab, copy : Nil copy, cut : Nil cut, find : Nil find, get_key_state(key_name : String | Symbol | Int32) : Int16 get_key_state, hold_key(key_name : String | Symbol | Int32, duration : Float64) : Nil hold_key, key_combination(keys : Array(String | Symbol | Int32)) : Nil
key_combination(*keys : String | Symbol | Int32) : Nil
key_combination
, key_down(key_name : String | Symbol | Int32) : Nil key_down, key_pressed?(key_name : String | Symbol | Int32) : Bool key_pressed?, key_stroke(key_name : String | Symbol | Int32) : Nil key_stroke, key_toggled?(key_name : String | Symbol | Int32) : Bool key_toggled?, key_up(key_name : String | Symbol | Int32) : Nil key_up, lock_screen : Nil lock_screen, new : Nil new, open : Nil open, paste : Nil paste, print_screen : Nil print_screen, redo : Nil redo, repeat_key(key_name : String | Symbol | Int32, count : Int32, delay : Float64 = 0.1) : Nil repeat_key, run_dialog : Nil run_dialog, save : Nil save, screenshot_window : Nil screenshot_window, select_all : Nil select_all, show_desktop : Nil show_desktop, task_manager : Nil task_manager, type(text : String) : Nil type, type_with_delay(text : String, delay : Float64 = 0.05) : Nil type_with_delay, undo : Nil undo, windows_key : Nil windows_key

Instance methods inherited from module AutoClick::Mouse

click_at(x : Int32, y : Int32, button : Symbol = :left) : Nil click_at, double_click : Nil double_click, double_click_at(x : Int32, y : Int32) : Nil double_click_at, drag(sx : Int32, sy : Int32, ex : Int32, ey : Int32, button : Symbol = :left) : Nil drag, left_click : Nil left_click, left_drag(sx : Int32, sy : Int32, ex : Int32, ey : Int32) : Nil left_drag, middle_click : Nil middle_click, mouse_button_pressed?(button : Symbol) : Bool mouse_button_pressed?, mouse_down(button_name : Symbol) : Nil mouse_down, mouse_scroll(steps : Int32) : Nil mouse_scroll, mouse_up(button_name : Symbol) : Nil mouse_up, right_click : Nil right_click, right_drag(sx : Int32, sy : Int32, ex : Int32, ey : Int32) : Nil right_drag, scroll_down(steps : Int32 = 1) : Nil scroll_down, scroll_up(steps : Int32 = 1) : Nil scroll_up, smooth_move(x : Int32, y : Int32, steps : Int32 = 10, delay : Float64 = 0.01) : Nil smooth_move

Instance Method Detail

def cursor_position : Array(Int32) #

Get current cursor position

Returns an array containing [x, y] coordinates


[View source]
def mouse_move(x : Int32, y : Int32) : Nil #

Move cursor to specified coordinates

  • x: X coordinate in pixels
  • y: Y coordinate in pixels

[View source]
def mouse_move_percentage(x_percent : Float64, y_percent : Float64) : Nil #

Move cursor using percentage of screen dimensions

  • x_percent: X position as percentage (0.0 to 1.0)
  • y_percent: Y position as percentage (0.0 to 1.0)

[View source]
def screen_resolution : Array(Int32) #

Get current screen resolution

Returns an array containing [width, height] in pixels


[View source]