module

AutoClick::Keyboard

Keyboard operations for AutoClick

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

Instance methods

__debug_letter_shift_needed(char : Char, caps_on : Bool) : Bool

Internal helper (debug/testing) to compute whether shift would be used for a letter given a desired character and caps lock state without mutating real state.

Source
alt_f4

Alt+F4 (close window)

Source
alt_tab

Alt+Tab (switch windows)

Source
copy

Copy (Ctrl+C)

Source
cut

Cut (Ctrl+X)

Source
find

Find (Ctrl+F)

Source
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)
Source
hold_key(key_name : String | Symbol | Int32, duration : Float64, *, raise_unknown : Bool = false) : Nil

Hold a key for a specified duration

  • key_name: Key name to hold
  • duration: Duration to hold the key in seconds
Source
input_text(text : String, *, toggle_capslock : Bool = false, raise_unknown : Bool = false) : Nil

Input a string of text (renamed from type)

  • text: String to send as key events
Source
input_text_with_delay(text : String, delay : Float64 = 0.05, *, toggle_capslock : Bool = false, raise_unknown : Bool = false) : Nil

Type text with delay between characters

  • text: String to type
  • delay: Delay between characters in seconds (default: 0.05)
Source
key_combination(keys : Array(String | Symbol | Int32), *, raise_unknown : Bool = false) : Nil

Send key combination from array

  • keys: Array of key names to press simultaneously
Source
key_combination(*keys : String | Symbol | Int32, raise_unknown : Bool = false) : Nil

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

  • keys: Array of key names to press simultaneously
Source
key_down(key_name : String | Symbol | Int32, *, raise_unknown : Bool = false) : Nil

Press and hold a key

  • key_name: Key name (String, Symbol, or Integer virtual key code)
Source
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
Source
key_stroke(key_name : String | Symbol | Int32, *, raise_unknown : Bool = false) : Nil

Press and release a key (key stroke)

  • key_name: Key name (String, Symbol, or Integer virtual key code)
Source
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
Source
key_up(key_name : String | Symbol | Int32, *, raise_unknown : Bool = false) : Nil

Release a key

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

Win+L (lock screen)

Source
new

New (Ctrl+N)

Source
open

Open (Ctrl+O)

Source
paste

Paste (Ctrl+V)

Source
redo

Redo (Ctrl+Y)

Source
repeat_key(key_name : String | Symbol | Int32, count : Int32, delay : Float64 = 0.1, *, raise_unknown : Bool = false) : 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)
Source
run_dialog

Win+R (run dialog)

Source
save

Save (Ctrl+S)

Source
screenshot_window

Alt+Print Screen (screenshot active window)

Source
select_all

Select All (Ctrl+A)

Source
show_desktop

Win+D (show desktop)

Source
task_manager

Ctrl+Shift+Esc (task manager)

Source
undo

Undo (Ctrl+Z)

Source
windows_key

Windows key (open start menu)

Source