Citrix ICA Vuser Functions (CTRX) > Alphabetical List of Functions > ctrx_sync_on_text


Example Citrix Synchronization Functions

Waits until specified text is displayed around the specified position.

int ctrx_sync_on_text( long xpos, long ypos, const char *value, eObjAttribute textEvent, const char *window_name, [CONTINUE_ON_ERROR,] CTRX_LAST );

xpos The horizontal distance in pixels from the left border of the ICA client window.
ypos The vertical distance in pixels from the upper border of the ICA client window.
value The text to for which to wait.
textEvent TEXT to sync with object, CAPTURE to use saved text in box, or CAPTURE_LINE to use saved text in narrow box.
window_name The 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 run-time setting for this step so that script behaves as though the run-time setting was Continue on error.
CTRX_LAST A marker that indicates the end of the argument list.

ctrx_sync_on_text is a synchronization function that waits for a specified string to appear at the specified position before continuing.

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

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

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 call. Use CAPTURE or CAPTURE_LINE as the textEvent argument.

When CAPTURE is used as the textEvent argument, ctrx_sync_on_text readsthe text within a rectangle of 80 by 80 pixels centered on the coordinates passed in the first 2 parameters. When CAPTURE_LINE is used, a rectangle of 80 by 10 pixels is read.

When TEXT is used as the textEvent argument, ctrx_sync_on_text waits for the appearance of an object at the given coodinates whose text property is the value. To use TEXT, you must know the properties of the underlying object. Therefore, TEXT is generally not used when manually enhancing a script.

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

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

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

Return Values

Citrix ICA Return Values


No parameterization is available for this function.


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

ctrx_sync_on_text(421, 368, "OK", TEXT, "NULL=snapshot67", CTRX_LAST );
ctrx_obj_mouse_click("<class=Button text=OK>", 421, 368, LEFT_BUTTON, 0, "NULL=snapshot67", CTRX_LAST );