Skip to main content

Citrix Recording Tips

Best Practices for Recording

  • Add comments to document the script recording. This will help you remember how to navigate each step of the business process.

  • Citrix Events may not always be consistent due to caching and variability with how Citrix raises the events. A window that was Created/Destroyed may only be Activated/Deactivated on a second iteration.

  • Develop scripts using the recording as a basis and take additional recordings as and when they are needed. You may need to find the co-ordinates of part of the screen, take an additional screen capture or record a Citrix event (with caption) which was missed or forgotten about when the business process was originally recorded. The relevant code snippets can then be copied and pasted into the script you are developing. The Citrix Viewer available from the Tools menu is the same tool as the Citrix recorder, but the output trace and files are written to the %TEMP% folder. See the file StartCitrixRecorder.bat in the product installation bin/ folder for the exact paths. You can edit this file to use different paths. You can also use the WinSpy tool for image management and finding coordinates.

  • Try to use keystrokes and key combinations for reliability, to minimize overhead and simplify scripts. Note that you should occasionally use an image or event match to ensure the application is in a suitable state to accept the keystrokes.

  • Remember that Citrix event synchronization points can be modified after the recording (and subsequent script generation) to allow partial matching of window captions. i.e.

    // The WaitForEvent statement below waits up to 20 seconds
    // for the creation of the window that has the caption "Untitled - Notepad"
    WaitForEvent(
    new CitrixEvent(CitrixEventType.WindowCreate, @"Untitled - Notepad"),
    TimeSpan.FromSeconds(20),
    WindowCaptionMatchType.Equals);

    // This could be modified to provide greater flexibility so that
    // the match wouldn't fail when the text file was something other than "Untitled"
    WaitForEvent(
    new CitrixEvent(CitrixEventType.WindowCreate, @"- Notepad"),
    TimeSpan.FromSeconds(20),
    WindowCaptionMatchType.EndsWith);
  • Be careful not to resize or move any windows unnecessarily during the recording as this may change the position/dimension of the window the next time it is launched. Setting windows to full screen will ensure consistent locations.

  • Remember keystrokes are sent when in capture mode but not recorded. This can be particularly useful when resetting the screen so a step in the business process can be re-captured should a mistake have been made etc.

Choosing Regions of the Screen for Synchronization

  • Use the smallest image that will uniquely identify a screen region.
  • Minimize the search area to reduce search overhead. This can be done by reducing the Search Radius value in the image capture dialog. Only use large search areas, or the whole screen if you know the image location can change within the search area.
  • Ensure FontSmoothingType = 1 and FontSmoothingTypePref = 1 are set in the recorder, ICA file (if used), and replay script. This turns off font smoothing (ClearType) for more reliable image matching on text. You may also need to disable ClearType on your client to ensure consistent text display.
  • Set the same color depth value on the recorder, ICA file (if used), and in the replay script. Reducing the DesiredColor value from the default setting for the Citrix application is not recommended as you can get color variation when the client reduces (interpolates) to a lower color depth.
  • Using a different windows platform for recording and replay risks introducing image variations.
  • As you capture images, these images appear beneath Existing Screenshots in the right side of the Citrix Recorder. You can reuse these captured images to add commands to your scripts instead of capturing identical images multiple times. For instance, you might need to find or click the same image multiple times during a recording. To remove an image that you don't plan to use in your scripts, right-click the image, then select Delete in the context menu.

Watch the Positioning of Mouse and Text Cursors

  • Careless cursor positioning in the vicinity of a control even if it this outside the co-ordinates of the screen portion could be enough to give an inaccurate screen capture (when recording) or cause synchronization to fail on playback.
  • Modern applications have an interactive nature meaning a mouse cursor left 'hovering' or the positioning of the text cursor in a certain area could cause synchronization to fail. Controls making up the application's GUI (Graphical User Interface) often use borders or highlighting to notify the user where cursors reside on the screen i.e. tab spacing the text cursor around buttons inside the application window.

Ask if the Citrix Application can Use Windows Classic Theme

  • Transparency, graduated backgrounds, and similar user interface feature can make image matching more challenging. The Windows Classic theme provides a more basic, consistent user interface.