Keyboard - FlaUI/FlaUI GitHub Wiki
A keyboard helper class is also available. You can access it by using the static Keyboard
class.
There are three kind of methods:
- Press - Presses the desired key
- Release - Releases the desired key
- Type - Presses and releases the desired key
For input, there are also several types:
- Scan-Code
- Virtual Key-Code
- Enum
VirtualKeyShort
- char
- string
If you want to type multiple keys, you can pass multiple VirtualKeyShort
values into the method:
// Type A and then B
Keyboard.Type(VirtualKeyShort.KEY_A, VirtualKeyShort.KEY_B);
If you need to press them simultaneously, use the following:
// Press Alt and hold it, then type 1 and then release Alt
Keyboard.TypeSimultaneously(VirtualKeyShort.ALT, VirtualKeyShort.KEY_1);
If you do want to add additional logic while pressing a key, you can use the following:
// Press Alt and hold it, execute the custom logic, then release Alt
using (Keyboard.Pressing(VirtualKeyShort.ALT))
{
// Some custom logic
}