ExampleCitrix Synchronization Functions

Waits until a window is created or becomes active.

int ctrx_sync_on_window( char *window_name, eWindowEvent event, long x_start, long y_start, long width, long height, char *filename, [CONTINUE_ON_ERROR,] CTRX_LAST );

window_nameThe window title.

The event indicating success: CREATE or ACTIVE.

  • CREATE. The window exists.

  • ACTIVE. The window exists and is in the foreground.
Tip: CREATE is recommended for use with menu items, which do not have a foreground window event when they are opened. ACTIVE is recommended for all other window types.
x_startThe horizontal distance in pixels of the window's left edge from the left edge of the ICA client window.
y_startThe vertical distance in pixels of the window's top edge from the top edge of the ICA client window.
widthThe width in pixels of the window.
heightThe height in pixels of the window.
filenameThe name of the image file containing a screen shot of the window. This file is located in the script directory under \data\snapshots.
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_window is a synchronization function that waits for a window to become created or active.

For objects that are never truly active, such as menu items, use the CREATE event to synchronize your actions. For regular windows, specify the ACTIVE event, which occurs after the CREATE event. This ensures that the window is stable.

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

Return Values

Citrix ICA Return Values


No parameterization is available for this function.


In the following example, the test run waits for the ICA Administrator toolbar to become active.

Copy code
ctrx_set_connect_opt(NETWORK_PROTOCOL, "TCP/IP + HTTP");
ctrx_connect_server("plato", "test", lr_unmask("3de476be2c6b6455"), "plato", CTRX_LAST);
ctrx_sync_on_window("ICA Administrator Toolbar", ACTIVATE, 768, 0, 33, 573, "129c54d64c9679ea1a0cb8bb02c2a981", CTRX_LAST );
ctrx_sync_on_window("2_233_205_344", CREATE, 2, 233, 205, 344, "060460d39afede68e26c5a8437a94a83", CTRX_LAST );