Action
Sends a set of keystrokes to the specified console.
Availability
This functionality is supported only if you are using the Open Agent.
Syntax
Console.TypeKeysInWindow (sEvents, sItemIdentifier)
Variable
|
Description
|
sEvents
|
The keystrokes to type.
STRING.
|
sItemIdentifier
|
The index of the console window or the caption of the window. If this parameter is left blank,
Silk Test Classic sends the keystrokes to the first found console window.
STRING.
|
Notes
- On Windows,
TypeKeysInWindow first gives the specified console input focus before typing into it.
- You can use
SetOption to set a delay between keystrokes with the
OPT_KEYBOARD_DELAY option. If keystrokes are not recognized, you can try to use a higher value for the delay.
- A key can be followed by a counter, which defines how often the keys should be typed.
- During the delay time, the screen is locked and interaction with the mouse and keyboard is no longer possible.
Examples
The following code samples execute the
dir command on the specified console window to list all the files and directories in the current directory:
//dir is executed on the second console window
Console.TypeKeysInWindow ("dir<Enter>", 2)
//dir is executed on the specified console window
Console.TypeKeysInWindow ("dir<Enter>", "C:\\Windows\\system32\\cmd.exe[1]")