ExampleCitrix Synchronization Functions

Waits until specified text is displayed in the specified area.

int ctrx_sync_on_text_ex( long xpos, long ypos, long width, long height, const char *value, const char *window_name, [CONTINUE_ON_ERROR,] CTRX_LAST );

xposThe horizontal distance in pixels of the search rectangle from the left border of the ICA client window.
yposThe vertical distance in pixels of the search rectangle from the upper border of the ICA client window.
widthThe width of the search rectangle in pixels.
heightThe height of the search rectangle in pixels.
valueThe text to for which to wait.
window_nameThe window title. The asterisk wildcard character (*) can be used in window_name.
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_sync_on_text_ex is a synchronization function that waits for a specified string to appear in the specified area before continuing.

This function is available only if the agent is installed on the Citrix server.

When ctrx_sync_on_text_ex is recorded, the textEvent argument is set by the logic of the recording engine. Do not edit it.

ctrx_sync_on_text_ex can be inserted in a script during recording or after recording from the script tree view.

If you wish to enter the function manually, run the script once using ctrx_get_text to find the exact string. Then, comment out the ctrx_get_text call and enter the string as the value argument in the ctrx_sync_on_text_ex call.

ctrx_sync_on_text_ex function is recorded automatically before each mouse click and double click.


  • Under Windows XP, to correctly record menu entries during recording, give the window focus before clicking on the menu item.

  • The Citrix agent supports text-trapping functions (ctrx_sync_on_text_ex and ctrx_get_text) only on Windows 8.1 and Windows Server 2012 R2.

Return Values

Citrix ICA Return Values


No parameterization is available for this function.


In this example, ctrx_sync_on_text_ex causes script execution to pause until the text "OK" appears at the location of the command button.

            ctrx_sync_on_text_ex(410, 350, 180, 80, "OK", "NULL=snapshot67", CTRX_LAST );
ctrx_obj_mouse_click("<class=Button text=OK>", 421, 368, LEFT_BUTTON, 0, "NULL=snapshot67", CTRX_LAST );