Example: TE_typeSend Text Functions

Sends a string to the terminal emulator.

int TE_type( const char *string );


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:


    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


    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.


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