Type input into a Terminal Emulator
Two TE Vuser functions enable Vusers to "type" character input into the PowerTerm terminal emulator:
-
TE_type sends characters to the terminal emulator. When recording, the VuGen automatically generates TE_type functions for keyboard input to the terminal window. For details, see below.
-
TE_typing_style determines the speed at which the Vuser types. You can manually define the typing style by inserting a TE_typing_style function into the Vuser script. Alternatively, you can set the typing style by using the runtime settings. For more information, see Runtime settings.
Note: While recording an RTE Vuser script, do not use the mouse to relocate the cursor within the terminal emulator window. VuGen does not record these cursor movements.
For more information about these functions and their conventions, see the Function Reference.

When you record a script, the VuGen records all keyboard input and generates appropriate TE_type functions. During execution, TE_type functions send formatted strings to the terminal emulator.
Keyboard input is defined as a regular text string (including blank spaces). For example:
TE_type ("hello, world");
Input key names longer than one character are represented by identifiers beginning with the letter k, and are bracketed within greater-than/less-than signs (< >).
For example, the following function depicts the input of the Return key followed by the Control and y keys:
TE_type("<kReturn><kControl-y>");
Some other examples include: <kF1>, <kUp>, <kF10>, <kHelp>, <kTab>.
To determine a key name, record an operation on the key, and then check the recorded statement for its name.
Note: When you program a TE_type statement (rather than recording it), use the key definitions provided in the Function Reference.
Set the timeout value for TE_type
If a Vuser attempts to submit a TE_type statement while the system is in X SYSTEM (or input inhibited) mode, the Vuser waits until the X SYSTEM mode ends before typing. If the system stays in X SYSTEM mode for more than TE_XSYSTEM_TIMEOUT milliseconds, then the TE_type function returns a TE_TIMEOUT error.
You can set the value of TE_XSYSTEM_TIMEOUT by using TE_setvar. The default value for TE_XSYSTEM_TIMEOUT is 30 seconds.
Allow a Vuser to type ahead
Under certain circumstances you may want a Vuser to submit a keystroke even though the system is in X SYSTEM (or input inhibited) mode. For example, you may want the Vuser to press the Break
key. You use the TE_ALLOW_TYPEAHEAD variable to enable the Vuser to submit a keystroke even though the system is in X SYSTEM mode.
Set TE_ALLOW_TYPEAHEAD to zero to disable typing ahead, and to any non-zero number to permit typing ahead. You use TE_setvar to set the value of TE_ALLOW_TYPEAHEAD. By default, TE_ALLOW_TYPEAHEAD is set to zero, preventing keystrokes from being sent during X SYSTEM mode.


You can set two typing styles for RTE Vuser: FAST and HUMAN. In the FAST style, the Vuser types input into the terminal emulator as quickly as possible. In the HUMAN style, the Vuser pauses after typing each character. In this way, the Vuser more closely emulates a human user typing at the keyboard.
You set the typing style using the TE_typing_style function. The syntax of the TE_typing_style function is:
int TE_typing_style (char * style );
where style can be FAST or HUMAN. The default typing style is HUMAN. If you select the HUMAN typing style, the format is:
HUMAN, delay [, first_delay]
The delay indicates the interval (in milliseconds) between keystrokes. The optional parameter first_delay indicates the wait (in milliseconds) before typing the first character in the string. For example,
TE_typing_style ("HUMAN, 100, 500"); TE_type ("ABC");
means that the Vuser waits 0.5 seconds before typing the letter A; it then waits 0.1 seconds before typing "B" and then a further 0.1 seconds before typing "C".
In addition to setting the typing style by using the TE_typing_style function, you can also use the runtime settings. For details, see Runtime settings.
