TE_type

Send Text Functions

Sends a string to the terminal emulator.

int TE_type( const char *string );

Inputs

stringAny string. Special keys are identified using the "<Key>" notation, as described below.

The TE_type function depicts the keyboard input sent to the terminal emulator.

Keyboard input is evaluated to a string using the following conventions:

  • Plain text can be input 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/less than signs (< >). For example, the line:

    TE_type("<kReturn><kControl-y>");

    depicts the input of the Return key followed by the left Control and y keys.

    See TE_type Key Definitions.

  • Pauses between keystrokes are indicated by the letter t followed by an integer, representing the number of time units, enclosed by (< >). The statement

    TE_type("hello, <t3>world");

    depicts a pause of 3 seconds between the input of the words hello and world. The lowercase t can be replaced by a capital T, which indicates milliseconds.

  • Key sequences, in which more than one key is pressed simultaneously, are represented by the sequence of characters, separated by hyphens (-), and enclosed by (< >). The statement

    TE_type("<kControl-kAlt-kDelete>");

    Control, Alt, and Delete should be input, and released, simultaneously.

 

The following characters must be included in angle-brackets when they appear in a TE_type statement:

\ backslash <kBackslash>
" quotes <kQuote>
> greater than (only when it appears inside a (< >) clause) <kGreater>
< less than (only when it does not appear inside a (<>) clause) <kLess>

If a script attempts to submit a TE_type statement while the system is in X-SYSTEM mode, the script will wait 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.

Return Values

This function returns 0 if it succeeds, and a negative error code if it fails. It also sets the global variable TE_errno.

Parameterization

You cannot use standard parameterization for any arguments in this function.

Example

The following segment sends an amount to be deposited and waits for the client application to respond.

Copy code
 /* Declare variables for TE_wait_text */
int ret_row;
int ret_col;
char ret_text [80];
lr_start_transaction (command);
 /* send amount */
TE_type ("{deposit_amount}<kReturn>");
 /* Wait for response */
TE_wait_text ("!Operation failed|Withdraw", 30, 1, 1, 0, 0, NULL, NULL, match);
if (TE_errno != TE_SUCCESS) {
    lr_end_transaction (command, LR_FAIL);
    lr_error_message ("TE_wait_text failed \n);
    return:
}
else {
    lr_end_transaction (command, LR_SUCCESS);
}