Wednesday, July 3, 2013

RTE Protocol-Reading Text from the Terminal Screen


There are several Vuser functions that RTE Vusers can use to read text from
the terminal screen. You can use these functions, TE_find_text and
TE_get_text_line, to check that the terminal emulator is responding
correctly, or to enhance the logic in your scripts.

After recording, you can manually insert TE_find_text and TE_get_text_line
statements directly into your RTE Vuser scripts.
Searching for Text on the Screen

The TE_find_text function searches for a line of text on the screen. The
syntax of the function is:
int TE_find_text (char *pattern, int col1, int row1, int col2, int row2,
int *retcol, int *retrow, char *match);

This function searches for text matching pattern within the rectangle
defined by col1, row1, col2, row2. Text matching the pattern is returned to
match, and the actual row and column position is returned to retcol and
retrow. The search begins in the top-left corner. If more than one string
matches pattern, the one closest to the top-left corner is returned.
The pattern can include a regular expression. See the Online Function
Reference for details on using regular expressions.

You must manually type TE_find_text statements into your Vuser scripts. For
details on the syntax of the TE_find_text function, see the Online Function
Reference (Help > Function Reference).
Reading Text from the Screen
The TE_get_text_line function reads a line of text from the area of the screen
that you designate. The syntax of the function is:
char *TE_get_text_line (int col, int row, int width, char *text);

This function copies a line of text from the terminal screen to a buffer text.
The first character in the line is defined by col, row. The column coordinate
of the last character in the line is indicated by width. The text from the
screen is returned to the buffer text. If the line contains tabs or spaces, the
equivalent number of spaces is returned.

In addition, the TE_get_cursor_position function can be used to retrieve the
current position of the cursor on the terminal screen. The
TE_get_line_attribute function returns the character formatting (for
instance, bold or underline) of a line of text.

You must manually type TE_get_text_line statements into your Vuser
scripts. For details on the syntax of the TE_get_text_line function, see the
Online Function Reference (Help > Function Reference).

No comments: