Class keys
Keyboard functions. Send virtual keystrokes and text to the active window, get key state, wait for key.
public class keys
Remarks
The main function is keys.send. Most documentation is there. See also keys.sendt. These functions use opt.key. Alternatively can be used keys variables, see keys.keys.
Examples
keys.send("Ctrl+Shift+Left"); //press Ctrl+Shift+Left
opt.key.KeySpeed = 300; //set options for static functions
keys.send("Ctrl+A Del Tab*3", "!text", "Enter", 500); //press Ctrl+A, Del, Tab 3 times, send text, Enter, wait 500 ms
keys.sendt("text\r\n"); //send text that ends with newline
Namespace: Au
Assembly: Au.dll
Constructors
Name | Description |
---|---|
keys(OKey) |
Properties
Name | Description |
---|---|
Options | Options used by this variable. |
isAlt | Returns |
isCapsLock | Returns |
isCtrl | Returns |
isNumLock | Returns |
isScrollLock | Returns |
isShift | Returns |
isWin | Returns |
Methods
Name | Description |
---|---|
Add(params KKeysEtc[]) | Adds keystrokes, text, sleep and other events to the internal collection. They will be sent/executed by keys.SendNow. |
AddAction(Action) | Adds a callback function. |
AddChar(char) | Adds single character to the internal collection. It will be sent like text with option OKeyText.KeysOrChar. |
AddClipboardData(clipboardData) | Adds clipboard data, for example several formats. It will be pasted by keys.SendNow. |
AddKey(KKey, bool?) | Adds single key, specified as KKey, to the internal collection. It will be sent by keys.SendNow. |
AddKey(KKey, ushort, bool, bool?) | Adds single key to the internal collection. Allows to specify scan code and whether it is an extended key. It will be sent by keys.SendNow. |
AddKeys(string) | Adds keystrokes to the internal collection. They will be sent by keys.SendNow. |
AddRepeat(int) | Adds the repeat operator. Then keys.SendNow will send the last added key or character count times. |
AddSleep(int) | Adds a short pause. Then keys.SendNow will sleep (wait). |
AddText(string, OKeyText) | Adds text with explicitly specified sending method (keys, characters or paste). |
AddText(string, string) | Adds text or HTML. It will be sent by keys.SendNow. |
SendNow(bool) | Sends keys, text and executes other events added with the AddX functions. |
getMod(KMod) | Gets flags indicating which modifier keys are pressed: |
isMod(KMod) | Returns |
isPressed(KKey) | Returns |
send(params KKeysEtc[]) | Generates virtual keystrokes (keys, text). |
sendL(params KKeysEtc[]) | Generates virtual keystrokes. Like keys.send, but without reliability features: delays, user input blocking, resetting modifiers/ |
sendt(string, string) | Sends text to the active window, using virtual keystrokes or clipboard. |
waitForHotkey(Seconds, KHotkey, bool) | Registers a temporary hotkey and waits for it. |
waitForKey(Seconds, KKey, bool, bool) | Waits for key-down or key-up event of the specified key. |
waitForKey(Seconds, bool, bool) | Waits for key-down or key-up event of any key, and gets the key code. |
waitForKey(Seconds, string, bool, bool) | Waits for key-down or key-up event of the specified key. |
waitForKeys(Seconds, Func<Keyboard, bool>, bool) | Waits for keyboard events using callback function. |
waitForNoModifierKeys(Seconds, KMod) | Waits while some modifier keys ( |
waitForNoModifierKeysAndMouseButtons(Seconds, KMod, MButtons) | Waits while some modifier keys ( |
waitForReleased(Seconds, params KKey[]) | Waits while the specified keys or/and mouse buttons are pressed. |
waitForReleased(Seconds, string) | Waits while the specified keys are pressed. |
Events
Name | Description |
---|---|
Pasting | Before pasting text through clipboard. |