Docs · API reference · Motus.Abstractions

IKeyboard Interface#

Provides methods for keyboard input.

public interface IKeyboard

Methods#

DownAsync(string) Method#

Dispatches a key down event.

System.Threading.Tasks.Task DownAsync(string key);

Parameters#

key System.String

The key to press (e.g. "Shift", "a", "ArrowDown").

Returns#

System.Threading.Tasks.Task

InsertTextAsync(string) Method#

Inserts text directly without dispatching individual key events.

System.Threading.Tasks.Task InsertTextAsync(string text);

Parameters#

text System.String

The text to insert.

Returns#

System.Threading.Tasks.Task

PressAsync(string, KeyboardPressOptions) Method#

Presses a key (dispatches key down, then key up).

System.Threading.Tasks.Task PressAsync(string key, Motus.Abstractions.KeyboardPressOptions? options=null);

Parameters#

key System.String

The key to press (e.g. "Enter", "Control+c").

options KeyboardPressOptions

Press options.

Returns#

System.Threading.Tasks.Task

TypeAsync(string, KeyboardTypeOptions) Method#

Types text character by character, dispatching key events for each character.

System.Threading.Tasks.Task TypeAsync(string text, Motus.Abstractions.KeyboardTypeOptions? options=null);

Parameters#

text System.String

The text to type.

options KeyboardTypeOptions

Typing options.

Returns#

System.Threading.Tasks.Task

UpAsync(string) Method#

Dispatches a key up event.

System.Threading.Tasks.Task UpAsync(string key);

Parameters#

key System.String

The key to release.

Returns#

System.Threading.Tasks.Task