TypeKeys Method (ConsoleClass)

Class

ConsoleClass.

Action

Sends a set of keystrokes to the console.

Availability

This functionality is supported only if you are using the Open Agent.

Syntax

Console.TypeKeys (sEvents)
Variable Description
sEvents The keystrokes to type. STRING.

Notes

  • If no console is open, TypeKeys opens a console.
  • On Windows, TypeKeys first gives the 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 executes the dir command in a console window to list all the files and directories in the current directory:

//dir is executed
Console.TypeKeys ("dir<Enter>")