The string to type.
OptionaldelayMs: number
Non-negative minimum delay after every character, including the final character. Defaults to 0; scheduling can make waits longer.
Resolves after all characters have been injected and their requested delays have elapsed.
Sends a key combination (press then release).
Combo format: modifier keys joined with + followed by the main key.
Either-side modifiers: Ctrl, Shift, Alt, Win.
Lateral modifiers: LCtrl, RCtrl, LShift, RShift, LAlt, RAlt, LWin, RWin.
Key combination string, e.g. "Ctrl+Shift+T", "Alt+F4", "Enter".
OptionalsettleMs: number
Non-negative minimum delay applied after modifier key-downs before the main key and again after the main key before modifier release. No delay is applied when the combo has no modifiers. Defaults to 5; scheduling can make waits longer.
Resolves after the key press and modifier settle intervals complete.
Presses and holds a key or key combination without releasing it.
Use Keyboard.Release() to let go.
Key combination string, e.g. "Shift", "Ctrl+A".
Resolves after the key-down events are injected.
Creates a KeySequence builder for batching multiple keyboard operations.
All steps execute sequentially while holding the script's input lane, so other input operations cannot interleave between them. Call .Send() to execute the batch.
A new empty chainable sequence builder; call Send to execute its accumulated steps.
Registers a callback that fires on every raw keyboard event (key down and key up). The script enters an event loop and stays alive as long as this handler is registered.
Handler receiving a KeyEvent for each keyboard event.
Focuses a window and sends a key combination to it. This is a convenience wrapper that calls Window.Focus() followed by Keyboard.Press().
Window identifier from WindowInfo.id.
Key combination string, e.g. "Ctrl+C", "Enter".
Resolves after the window is focused and the key press completes.
USE CASE: Sending input to a specific app while keeping it in the foreground. The window is focused before the key is sent. For background delivery without stealing focus, use PostKey instead.
Posts a window message to a specific window using PostMessageW. Use for low-level message injection (e.g. WM_KEYDOWN, WM_CHAR).
Window identifier from WindowInfo.id.
Windows message identifier (for example 0x0100 for WM_KEYDOWN).
Message-specific non-negative wParam bit pattern within JavaScript's safe-integer range.
Message-specific signed lParam bit pattern within JavaScript's safe-integer range.
USE CASE: Background automation, the target window does not need to be focused.
LIMITATION: Unreliable for competitive games using Raw Input and DirectInput applications; use Keyboard.Press for those instead. Works well for standard Win32 and WPF applications.
Posts WM_KEYDOWN and WM_KEYUP messages for a key combination to a specific window.
Convenience wrapper around PostMessage that constructs proper keyboard messages including modifier keys and scan codes.
Window identifier from WindowInfo.id.
Key combination string, e.g. "Ctrl+V", "A".
USE CASE: Background key injection without focusing the window. Handles modifier key press/release ordering automatically. LIMITATION: Unreliable for games and DirectInput applications.
Types text character-by-character by simulating individual key presses.