ExampleCitrix Synchronization Functions

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

Important: OCR might consume a substantial amount of the hardware resources for the load generator machine, causing high CPU consumption warnings and/or limiting the amount of Vusers that can 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 );

xposThe horizontal distance in pixels from the left border of the ICA client window.
yposThe vertical distance in pixels from the upper border of the ICA client window.
widthOf rectangle in pixels.
heightOf rectangle in pixels.
valueThe text to for which to wait.
filenameThe 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 OCR 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.


  • OCR should not be used for text that is small.

  • Known issue: The OCR engine removes the spaces from the recognized text.

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",