module AutoClick::Keyboard

Overview

Keyboard operations for AutoClick

This module provides all keyboard-related functionality including key presses, text typing, and key state checking.

Extended Modules

Direct including types

Defined in:

auto_click/keyboard.cr

Instance Method Summary

Instance Method Detail

def alt_f4 : Nil #

Alt+F4 (close window)


[View source]
def alt_tab : Nil #

Alt+Tab (switch windows)


[View source]
def copy : Nil #

Copy (Ctrl+C)


[View source]
def cut : Nil #

Cut (Ctrl+X)


[View source]
def find : Nil #

Find (Ctrl+F)


[View source]
def get_key_state(key_name : String | Symbol | Int32) : Int16 #

Get the current state of a key

  • key_name: Key name (String, Symbol, or Integer virtual key code) Returns: Key state (negative if pressed, positive if toggled on for toggle keys)

[View source]
def hold_key(key_name : String | Symbol | Int32, duration : Float64) : Nil #

Hold a key for a specified duration

  • key_name: Key name to hold
  • duration: Duration to hold the key in seconds

[View source]
def key_combination(keys : Array(String | Symbol | Int32)) : Nil #

Send key combination from array

  • keys: Array of key names to press simultaneously

[View source]
def key_combination(*keys : String | Symbol | Int32) : Nil #

Send key combination (e.g., Ctrl+C, Alt+Tab)

  • keys: Array of key names to press simultaneously

[View source]
def key_down(key_name : String | Symbol | Int32) : Nil #

Press and hold a key

  • key_name: Key name (String, Symbol, or Integer virtual key code)

[View source]
def key_pressed?(key_name : String | Symbol | Int32) : Bool #

Check if a key is currently pressed

  • key_name: Key name (String, Symbol, or Integer virtual key code) Returns: true if key is pressed, false otherwise

[View source]
def key_stroke(key_name : String | Symbol | Int32) : Nil #

Press and release a key (key stroke)

  • key_name: Key name (String, Symbol, or Integer virtual key code)

[View source]
def key_toggled?(key_name : String | Symbol | Int32) : Bool #

Check if a toggle key is currently on (like Caps Lock, Num Lock)

  • key_name: Key name (String, Symbol, or Integer virtual key code) Returns: true if toggle key is on, false otherwise

[View source]
def key_up(key_name : String | Symbol | Int32) : Nil #

Release a key

  • key_name: Key name (String, Symbol, or Integer virtual key code)

[View source]
def lock_screen : Nil #

Win+L (lock screen)


[View source]
def new : Nil #

New (Ctrl+N)


[View source]
def open : Nil #

Open (Ctrl+O)


[View source]
def paste : Nil #

Paste (Ctrl+V)


[View source]
def print_screen : Nil #

Print Screen


[View source]
def redo : Nil #

Redo (Ctrl+Y)


[View source]
def repeat_key(key_name : String | Symbol | Int32, count : Int32, delay : Float64 = 0.1) : Nil #

Press a key multiple times

  • key_name: Key name to press
  • count: Number of times to press the key
  • delay: Delay between presses in seconds (default: 0.1)

[View source]
def run_dialog : Nil #

Win+R (run dialog)


[View source]
def save : Nil #

Save (Ctrl+S)


[View source]
def screenshot_window : Nil #

Alt+Print Screen (screenshot active window)


[View source]
def select_all : Nil #

Select All (Ctrl+A)


[View source]
def show_desktop : Nil #

Win+D (show desktop)


[View source]
def task_manager : Nil #

Ctrl+Shift+Esc (task manager)


[View source]
def type(text : String) : Nil #

Type a string of text

  • text: String to type

[View source]
def type_with_delay(text : String, delay : Float64 = 0.05) : Nil #

Type text with delay between characters

  • text: String to type
  • delay: Delay between characters in seconds (default: 0.05)

[View source]
def undo : Nil #

Undo (Ctrl+Z)


[View source]
def windows_key : Nil #

Windows key (open start menu)


[View source]