Citrix additional ways to synchronize your script
In addition to automatic and manual synchronization in Citric Vuser scripts, you can add certain other steps that affect the synchronization indirectly. For more information about the below steps, see the Function Reference (select the relevant version).
The ctrx_set_waiting_time step sets a waiting time for the other Citrix synchronization functions. This setting applies to all functions that follow it within the script. For example, if your ctrx_sync_on_window steps are timing out, you can increase the default timeout from 60 seconds to 180 seconds.
To insert this step, insert a ctrx_set_waiting_time step from the Steps toolbox.
The ctrx_win_exist step checks if a window is visible in the Citrix client. By adding control flow statements, you can use this function to check for a window that does not always open, such as a warning dialog box. In the following example, ctrx_win_exist checks whether a browser was launched. The second argument indicates how long to wait for the browser window to open. If the window did not open in the specified time, it double-clicks the application's icon to open it.
if (!ctrx_win_exist("Welcome",6, CTRX_LAST)) ctrx_mouse_double_click(34, 325, LEFT_BUTTON, 0, CTRX_LAST)
To insert this step, insert a ctrx_win_exist step from the Steps toolbox.
Another useful application for this step is to check if a window has been closed. If you need to wait for a window to close, you should use a synchronization step such as ctrx_unset_window.
In certain cases, you do not know what data or image will be displayed in an area, but you do expect it to change. To emulate this, you can use the ctrx_sync_on_bitmap_change function. Right-click in the snapshot, and select Insert Sync on Bitmap from the right-click menu. VuGen inserts the step or function at the location of the cursor.
The syntax of the functions is as follows:
Example: ctrx_sync_on_bitmap (x_start, y_start, width, height, hash, CTRX_LAST); ctrx_sync_on_bitmap_change (x_start, y_start, width, height, [initial_wait_time,] [timeout,] [initial_bitmap_value,] CTRX_LAST);
The following optional arguments are available for ctrx_sync_on_bitmap_change:
initial_wait_time. When to begin checking for a change.
timeout. The amount of time in seconds to wait for a change to occur before failing.
initial_bitmap_value. The initial hash value of the bitmap. Vusers wait until the hash value is different from the specified initial bitmap value.
In the following example, the recorded function was modified and assigned an initial waiting time of 300 seconds and a timeout of 400 seconds.
ctrx_sync_on_bitmap_change(93, 227, 78, 52,
Note: If you are using ctrx_sync_on_bitmap, make sure that the screen settings in Controller, Load Generator machine, and VuGen are the same. Otherwise, VuGen may be unable to find the correct bitmaps during replay. For information on how to configure the client settings, seeRecording options.