Share this page

# ctrx_set_window

Example | Citrix Synchronization Functions

Waits for a window to appear in the Citrix client.

`int ctrx_set_window( char *window_name, [window_state,] [CONTINUE_ON_ERROR,] CTRX_LAST );`

window_name | The window title.
window_state | Window state to wait for: WIN_EXISTS or WIN_ACTIVE. Note: The window_state argument can be used with or without quotes, both formats work.
CONTINUE_ON_ERROR | A constant, entered without quotes, as shown. Overrides the error behavior runtime setting for this step so that the 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 is a synchronization function that waits 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 waits for, as it appears in the window's top header frame. The asterisk wildcard character (*) can be used in window_name.

The window_state argument is optional. It indicates the state of the window that ctrx_set_window waits for. The function can wait for the window to appear (WIN_EXISTS) or to appear and become active (WIN_ACTIVE). This argument is similar to the event argument of ctrx_sync_on_window.

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.

## Return Values

Citrix ICA Return Values

## Parameterization

The parameter window_name can be parameterized.

## Example

    //wait for Notepad window to appear - no window_state argument
    ctrx_set_window("Untitled - Notepad", CTRX_LAST);

    //wait for Notepad window to appear - uses the window_state argument
    ctrx_set_window("Untitled - Notepad", WIN_EXISTS, CTRX_LAST);

    //wait for Notepad window to appear and become active
    ctrx_set_window("Untitled - Notepad", WIN_ACTIVE, 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: