Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.simular.ai/llms.txt

Use this file to discover all available pages before exploring further.

Class: KeyboardController

Defined in: index.d.ts:604 Contains functions to simulate key presses/releases and to input text. For entering text, the text method is best. If you want to enter a key without having to worry about the layout or the keymap, use the key method. If you want a specific (physical) key to be pressed (e.g WASD for games), use the raw method. The resulting keysym will depend on the layout/keymap.

Constructors

Constructor

new KeyboardController(): KeyboardController
Defined in: index.d.ts:605

Returns

KeyboardController

Methods

key()

key(key, direction): void
Defined in: index.d.ts:619 Sends an individual key event. It will enter the keysym (virtual key). Have a look at the raw method, if you want to enter a keycode. Some of the keys are specific to a platform.

Parameters

key
Key
direction
Direction

Returns

void

keyOther()

keyOther(value, direction): void
Defined in: index.d.ts:623 Sends a key event for a raw, platform-specific key value.

Parameters

value
number
direction
Direction

Returns

void

keyUnicode()

keyUnicode(value, direction): void
Defined in: index.d.ts:621 Sends an individual Unicode key event. Provide a single character.

Parameters

value
string
direction
Direction

Returns

void

raw()

raw(keycode, direction): void
Defined in: index.d.ts:635 Sends a raw keycode. The keycode may or may not be mapped on the current layout. You have to make sure of that yourself. This can be useful if you want to simulate a press regardless of the layout (WASD on video games). Have a look at the key method, if you just want to enter a specific key and don’t want to worry about the layout/keymap. Windows only: If you want to enter the keycode (scancode) of an extended key, you need to set the high byte for the extended key too. You can for example do: raw(0xE01D, Direction.Click) to simulate RControl.

Parameters

keycode
number
direction
Direction

Returns

void

text()

text(text): void
Defined in: index.d.ts:611 Enter the text. You can use unicode here like: ❤吅. This works regardless of the current keyboard layout. You cannot use this function for entering shortcuts or something similar. For shortcuts, use the key method instead.

Parameters

text
string

Returns

void