Class
KeyBoard

Keyboard events class.

Definition

Namespace:ArtOfTest.WebAii.Win32

Assembly:ArtOfTest.WebAii.dll

Syntax:

cs-api-definition
public class KeyBoard

Inheritance: objectKeyBoard

Fields

_desktop

Owner desktop object.

Declaration

cs-api-definition
protected readonly Desktop _desktop

Field Value

Desktop

Properties

KeyDownDelay

The amount of time a key is held down for during simulated typing

Declaration

cs-api-definition
public static int KeyDownDelay { get; set; }

Property Value

int

Methods

KeyDown(Keys)

Simulates a key down. (Press-Hold)

Declaration

cs-api-definition
public void KeyDown(Keys key)

Parameters

key

Keys

The key code

KeyPress(Keys)

Simulates a keyboard key press (down/up).

Declaration

cs-api-definition
public void KeyPress(Keys code)

Parameters

code

Keys

The key code

KeyPress(Keys, int)

Simulates a keyboard key press with a hold delay

Declaration

cs-api-definition
public void KeyPress(Keys code, int holdFor)

Parameters

code

Keys

The key code for the key to press.

holdFor

int

How long to hold the key down, in milliseconds.

KeyPress(Keys, int, int)

Repeat a set of key presses x number of times

Declaration

cs-api-definition
public void KeyPress(Keys code, int holdFor, int repeatCount)

Parameters

code

Keys

The key code

holdFor

int

Hold it for (msec)

repeatCount

int

The number of time to repeat it

KeyUp(Keys)

Simulates a key up. (Key-Release)

Declaration

cs-api-definition
public void KeyUp(Keys key)

Parameters

key

Keys

The key code.

KeysFromString(string)

Converts a key combination i.e CTRL+R or SHIFT+CTRL+R to a System.Windows.Keys value

Declaration

cs-api-definition
public static Keys KeysFromString(string keyCombination)

Parameters

keyCombination

string

The key combination to translate

Returns

Keys

The Keys value or Keys.None if it can't convert it

PressOrReleaseKey(Keys, bool)

Press or release a key.

Declaration

cs-api-definition
protected virtual void PressOrReleaseKey(Keys key, bool release = false)

Parameters

key

Keys

The keyboard key.

release

bool

True to simulate key release, false to simulate key press.

TypeText(string, int)

Types text one character at a time with a specific type speed. This function does not support special keywords (i.e {TAB}, {SPACE}) or special characters like ^,+..etc. to simulate special keys use KeyPress if you want to send special characters like Ctrl/Shift..etc.

Declaration

cs-api-definition
public void TypeText(string text, int delayBetweenKeypresses = 10)

Parameters

text

string

The text to type

delayBetweenKeypresses

int

The delay time between key presses.

TypeText(string, int, int)

Types text one character at a time with a specific type speed. This function does not support special keywords (i.e {TAB}, {SPACE}) or special characters like ^,+..etc. to simulate special keys use KeyPress if you want to send special characters like Ctrl/Shift..etc.

Declaration

cs-api-definition
public void TypeText(string text, int delayBetweenKeypresses, int keyHoldTime)

Parameters

text

string

The text to type

delayBetweenKeypresses

int

The delay time between key presses.

keyHoldTime

int

The delay between pressing and releasing a key

TypeText(string, int, int, bool)

Types text one character at a time with a specific type speed. This function does not support special keywords (i.e {TAB}, {SPACE}) or special characters like ^,+..etc. to simulate special keys use KeyPress if you want to send special characters like Ctrl/Shift..etc.

Declaration

cs-api-definition
public void TypeText(string text, int delayBetweenKeypresses, int keyHoldTime, bool supportUnicode)

Parameters

text

string

The text to type

delayBetweenKeypresses

int

The delay time between key presses.

keyHoldTime

int

The delay between pressing and releasing a key

supportUnicode

bool

Whether to support Unicode input in this call. By default, supportUnicode is true. See remarks regarding keyboard events and Unicode input.

Remarks

When Unicode support is enabled, KeyDown and KeyUp events are not fired by target controls. If KeyDown and KeyUp events are required, you must call TypeText with supportUnicode = false.

TypeTextNU(string, int, int)

Types text one character at a time with a specific type speed. This function does not support special keywords (i.e {TAB}, {SPACE}) or special characters like ^,+..etc. to simulate special keys use SendString if you want to send special characters like Ctrl/Shift..etc.

Declaration

cs-api-definition
protected virtual void TypeTextNU(string text, int delayBetweenKeypresses, int keyHoldTime)

Parameters

text

string

The text to type

delayBetweenKeypresses

int

The delay time between key presses.

keyHoldTime

int

The key hold time.

TypeTextUnicodeInt(string, int, int)

Type text in unicode.

Declaration

cs-api-definition
protected virtual void TypeTextUnicodeInt(string text, int delayBetweenKeypresses, int keyHoldTime)

Parameters

text

string

The text to type.

delayBetweenKeypresses

int

The delay between key presses.

keyHoldTime

int

The key hold time.