ExampleCitrix Synchronization Functions

Waits a specified time for a window to appear in the Citrix client.

int ctrx_set_window_ex( char *window_name, long waitTime, [CONTINUE_ON_ERROR,] CTRX_LAST );

window_nameThe window title.
waitTimeThe time, in seconds, to wait for window_name to appear
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.

When emulating a GUI user, a window must appear before it can be used.

ctrx_set_window_ex is a synchronization function that waits up to waitTime seconds for a window to appear before the Vuser emulates any keyboard or mouse activity in the window.

The window_name argument indicates the name of the window that ctrx_set_window_ex waits for, as it appears in the window's top header frame. The asterisk wildcard character (*) can be used in window_name.

waitTime is the timeout for the window to appear. If window_name does not appear in within this period, ctrx_set_window_ex exits. waitTime does not affect the timeout of other functions, only the call to ctrx_set_window_ex.

If there is a succession of windows appearing in a short period of time, VuGen will only record the last call to ctrx_set_window_ex.

Return Values

Citrix ICA Return Values


The parameter window_name can be parameterized


In the following example, after connecting to the Citrix server ludens, ctrx_set_window_ex waits for the window of Microsoft's Internet Explorer (with a timeout of 75 seconds). Internet Explorer's home page is the ABC site, so the string "ABC Corporation at abc.com" appears in the header frame of the window. When the window appears, the code then continues with the next statement, ctrx_mouse_click.

Actions () {

     ctrx_connect_server("ludens", "test", "test", "ludens", CTRX_LAST);

     /* Launch the web browser by clicking on desktop IE icon */
     ctrx_mouse_double_click(34, 325, LEFT_BUTTON, 0, NULL), CTRX_LAST;
               "ABC Corporation at abc*", 75, CTRX_LAST);

     /* Exit the web browser by clicking on top left Exit check box */
     ctrx_mouse_click(573, 61, LEFT_BUTTON, 0,
               "ABC Corporation at abc.com", CTRX_LAST);
              "ABC Corporation at abc.com", CTRX_LAST);

     ctrx_disconnect_server("ludens", CTRX_LAST);

     return 0;