AutoClick::Keyboard
Keyboard operations for AutoClick
This module provides all keyboard-related functionality including key presses, text typing, and key state checking.
Instance methods
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.
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)
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
Input a string of text (renamed from type)
- text: String to send as key events
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)
Send key combination from array
- keys: Array of key names to press simultaneously
Send key combination (e.g., Ctrl+C, Alt+Tab)
- keys: Array of key names to press simultaneously
Press and hold a key
- key_name: Key name (String, Symbol, or Integer virtual key code)
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
Press and release a key (key stroke)
- key_name: Key name (String, Symbol, or Integer virtual key code)
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
Release a key
- key_name: Key name (String, Symbol, or Integer virtual key code)