Share this page

# ctrx_get_text

Example | Information Retrieval Functions

Retrieves the text in a rectangle.

`int ctrx_get_text( char *window_name, long xpos, long ypos, long width, long height, char *filename, char *text_buffer, [CONTINUE_ON_ERROR,] CTRX_LAST );`

window_name | The window title. NULL if not within an active window.
xpos | The output parameter containing the horizontal distance of the rectangle from the left edge of the window
ypos | The output parameter containing the vertical distance of the rectangle from the edge of the window
width | The width of the window, in pixels
height | The height of the window, in pixels
filename | The snapshot. Do not edit this field
text_buffer | Output for the text
CONTINUE_ON_ERROR | A constant, entered as shown without quotes. Overrides the error behavior runtime setting for this step so that script behaves as though the runtime setting was Continue on error.
CTRX_LAST | A marker that indicates the end of the argument list.

ctrx_get_text assigns the text in a rectangle into text_buffer. The text can later be used in correlation.

Note:
- This function is available only if the Citrix agent is installed. For details, see Citrix agent overview in the VuGen Help Center (select the relevant version).
- The Citrix agent supports text-trapping functions (ctrx_sync_on_text, ctrx_sync_on_text_ex, and ctrx_get_text) only on Windows 8.1 and Windows Server 2012 R2.

The xpos, ypos are relative to the window if defined or to the ICA client if window_name is null.

The default text_buffer is named `text_buffer`. If you use `text_buffer`, there is no need to allocate memory for it. If you use your own buffer, you must allocate the space.

ctrx_get_text works only when the text is real text and not a bitmap. This function can be added manually or while recording, by using the rectangle button on the floating toolbar.

The asterisk wildcard character (*) can be used in window_name.

## Return Values

Citrix ICA Return Values

## Parameterization

No parameterization is available for this function.

## Example

This example gets text from the "About Notepad" dialog in the "text_buffer" parameter.

    ctrx_obj_mouse_click("<text=Untitled - Notepad class=Notepad>", 15, 32, LEFT_BUTTON, 0, "Untitled - Notepad=snapshot3", CTRX_LAST );
    ctrx_sync_on_window("104_37_118_50", CREATE, 104, 37, 118, 50, "snapshot4", CTRX_LAST );
    ctrx_obj_mouse_click("<class=#32768>", 141, 82, LEFT_BUTTON, 0, "Untitled - Notepad=snapshot5", CTRX_LAST );
    ctrx_sync_on_window("About Notepad", ACTIVATE, 30, 71, 420, 330, "snapshot6", CTRX_LAST );
    ctrx_get_text("About Notepad", 93, 105, 219, 74, "snapshot8", text_buffer, CTRX_LAST );

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: