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.crInstance Method Summary
-
#alt_f4 : Nil
Alt+F4 (close window)
-
#alt_tab : Nil
Alt+Tab (switch windows)
-
#copy : Nil
Copy (Ctrl+C)
-
#cut : Nil
Cut (Ctrl+X)
-
#find : Nil
Find (Ctrl+F)
-
#get_key_state(key_name : String | Symbol | Int32) : Int16
Get the current state of a key
-
#hold_key(key_name : String | Symbol | Int32, duration : Float64) : Nil
Hold a key for a specified duration
-
#key_combination(keys : Array(String | Symbol | Int32)) : Nil
Send key combination from array
-
#key_combination(*keys : String | Symbol | Int32) : Nil
Send key combination (e.g., Ctrl+C, Alt+Tab)
-
#key_down(key_name : String | Symbol | Int32) : Nil
Press and hold a key
-
#key_pressed?(key_name : String | Symbol | Int32) : Bool
Check if a key is currently pressed
-
#key_stroke(key_name : String | Symbol | Int32) : Nil
Press and release a key (key stroke)
-
#key_toggled?(key_name : String | Symbol | Int32) : Bool
Check if a toggle key is currently on (like Caps Lock, Num Lock)
-
#key_up(key_name : String | Symbol | Int32) : Nil
Release a key
-
#lock_screen : Nil
Win+L (lock screen)
-
#new : Nil
New (Ctrl+N)
-
#open : Nil
Open (Ctrl+O)
-
#paste : Nil
Paste (Ctrl+V)
-
#print_screen : Nil
Print Screen
-
#redo : Nil
Redo (Ctrl+Y)
-
#repeat_key(key_name : String | Symbol | Int32, count : Int32, delay : Float64 = 0.1) : Nil
Press a key multiple times
-
#run_dialog : Nil
Win+R (run dialog)
-
#save : Nil
Save (Ctrl+S)
-
#screenshot_window : Nil
Alt+Print Screen (screenshot active window)
-
#select_all : Nil
Select All (Ctrl+A)
-
#show_desktop : Nil
Win+D (show desktop)
-
#task_manager : Nil
Ctrl+Shift+Esc (task manager)
-
#type(text : String) : Nil
Type a string of text
-
#type_with_delay(text : String, delay : Float64 = 0.05) : Nil
Type text with delay between characters
-
#undo : Nil
Undo (Ctrl+Z)
-
#windows_key : Nil
Windows key (open start menu)
Instance Method Detail
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 a key for a specified duration
- key_name: Key name to hold
- duration: Duration to hold the key in seconds
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)
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)
Type text with delay between characters
- text: String to type
- delay: Delay between characters in seconds (default: 0.05)