ZenoTest
ZenoTest — Windows Desktop UI Testautomatisierung für Qt, WPF, WinForms & native Apps. Aufzeichnen, skripten und automatisierte GUI-Tests mit CI/CD-Integration ausführen.

SendKeys

void SendKeys(string keys)
void SendKeys(string control, string keys)

Description
Sends the specified key sequence to a target control or application window. If a control is specified, the function will first set focus to the target element by clicking on or inside it.
The function can simulate typing text, keyboard shortcuts, or special keys.
Modifier keys (CTRL, SHIFT, ALT) and special keys must be enclosed in curly braces `{}`. Multiple modifiers can be combined inside a single set of braces using `+`, e.g., `{CTRL+SHIFT+ESC}`.
You can also send multiple special keys in sequence, e.g., `{CTRL+A}{DELETE}`.

Parameters
- control (optional) - The identifier or name of the control to receive the key input. If omitted, keys are sent to the currently focused window.
- keys - The string representing the keys to send. Can include:
  - Plain characters (letters, digits, symbols)
  - Special keys enclosed in {}:
  • {ENTER}
  • {RETURN}
  • {NUMPADENTER}
  • {TAB}
  • {BACKSPACE}
  • {ESC}
  • {SPACE}
  • {LEFT}
  • {RIGHT}
  • {UP}
  • {DOWN}
  • {DELETE}
  • {HOME}
  • {END}
  • {PAGEUP} (alias {PGUP})
  • {PAGEDOWN} (alias {PGDN})
  • {CTRL}
  • {SHIFT}
  • {ALT}
  - Modifier key combinations inside {}:
  • {CTRL+C} - Copy
  • {CTRL+V} - Paste
  • {CTRL+A} - Select all
  • {CTRL+SHIFT+ESC} - Open Task Manager
  • {ALT+TAB} - Switch windows
  - Multiple special keys in sequence:
  • {CTRL+A}{DELETE} - Select all and delete
  • {HOME}{SHIFT+END}{DELETE} - Select entire line and delete
Examples
void main()
{
    SendKeys("P@ssw0rd");                   // Types the text into the currently focused input
    SendKeys("TXT_PASSWORD", "P@ssw0rd");   // Types the password into the password textbox
    SendKeys("{ENTER}");                    // Presses the Enter key in the currently focused window
    SendKeys("BTN_OK", "{ENTER}");          // Presses Enter in the specified control
    SendKeys("TEXT_INPUT", "1+1=");         // Types 1+1= literally, no modifiers
    SendKeys("APP_WINDOW", "{CTRL+SHIFT+ESC}"); // Opens Task Manager with Ctrl+Shift+Esc
    SendKeys("{CTRL+A}{DELETE}");           // Select all and delete in the currently focused window
}
#define #include abs Array ceil CloseAUT Console mode do...while DoubleClick DragAndDrop Execute Fail File floor for Format GetAUTFileVersion GetAUTProductVersion GetAUTQtVersion GetAUTSuspectedCompiler GetAUTSuspectedFramework GetClipboard GetCurrentDate GetCurrentTime GetCurrentWorkingDir GetEnv GetName GetProcessID GetProcessIDHandle GetQtProperty GetText GetTimestamp GetValue Handle HasFocus IsAUT64Bit IsChecked IsEnabled IsVisible LeftMouseClick LeftMouseDown LeftMouseUp max MiddleMouseClick MiddleMouseDown MiddleMouseUp min MouseMove MouseWheel Pass pow Predefined Constants Print rand Regex RegexMatch RightMouseClick RightMouseDown RightMouseUp round Script Language SendKeys SendMessage SetClipboard SetFocus SetGlobal SetQtProperty ShellProcess Sleep sqrt srand StartAUT string TerminateProcess TimerStart TimerStop TimerVerifyLess vec2d VerifyContains VerifyEmpty VerifyEndsWith VerifyEqual VerifyExists VerifyFalse VerifyGreater VerifyGreaterEqual VerifyLess VerifyLessEqual VerifyNotEqual VerifyNotExists VerifyScreenCompareEdgeBased VerifyScreenComparePixelExact VerifyStartsWith VerifyTrue WaitForControl WaitUntilEnabled WaitUntilVisible while