Example Citrix Synchronization Functions

Waits until specified text is displayed in the specified rectangle, using optical character recognition (OCR).

Important! Optical character recognition might consume a substantial amount of the hardware resources of the Load Generator machine, thus causing high CPU consumption warnings and/or limiting amount of Vusers that might run in parallel.

int ctrx_sync_on_text_ocr( long xpos, long ypos, long width, long height, const char *value, const char *filename, [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.
width Of rectangle in pixels.
height Of rectangle in pixels.
value The text to for which to wait.
filename The snapshot file. Do not edit this value.
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_text_ocr is a synchronization function that waits for a specified string to appear in the specified rectangle before continuing. This function uses optical character recognition to identify the string.

This function is useful for applications that do not use Windows GDI API to render text. For example, Internet Explorer uses DirectWrite API for text rendering.

The xpos, ypos are relative to the ICA client .

ctrx_sync_on_text_ocr function is not recorded. You can enter it manually in your scripts.

Note: Optical Character Recognition should not be used for text that is small.

Return Values

Citrix ICA Return Values


No parameterization is available for this function.


In this example, ctrx_sync_on_text_ocr causes script execution to pause until text "test" appears at the specified location in Notepad window.

ctrx_sync_on_text_ocr(304, 119, 30, 15, "test", "snapshot_109", CTRX_LAST);
ctrx_obj_mouse_click("<class=Notepad>", 310, 125, 
     LEFT_BUTTON, 0, "Untitled - Notepad=snapshot_110",