User Tools

Site Tools


en:code:device:keyboard

This is an old revision of the document!


Keyboard

This object allows you to simulate keyboard actions.

Functions

Keyboard

Constructor function.

Syntax

var myObject = new Keyboard();

Methods

pressKey

Presses a key.

Syntax

myObject.pressKey(key);

Arguments

  1. key - (string) the key to press

Returns

  • (Keyboard) this Keyboard

Exceptions

  • (PressKeyError) unable to press the key

Notes

The key parameter can be a single letter or a key name.

releaseKey

Releases a key.

Syntax

myObject.releaseKey(key);

Arguments

  1. key - (string) the key to release

Returns

  • (Keyboard) this Keyboard

Exceptions

  • (ReleaseKeyError) unable to release the key

Notes

The key parameter can be a single letter or a key name.

triggerKey

Triggers a key. (press and release)

Syntax

myObject.triggerKey(key);

Arguments

  1. key - (string) the key to trigger

Returns

  • (Keyboard) this Keyboard

Exceptions

  • (TriggerKeyError) unable to trigger the key

Notes

The key parameter can be a single letter or a key name.

writeText

Write text.

Syntax

myObject.writeText(text);
myObject.writeText(text, delay);

Arguments

  1. text - (string) the text to write
  2. delay - (int) the pause duration (milliseconds) between each character

Returns

  • (Keyboard) this Keyboard

Exceptions

  • (WriteTextError) unable to write the text
en/code/device/keyboard.1354985667.txt.gz · Last modified: 2021/02/13 11:23 (external edit)