Using Capture area action from OCR package

Use the Capture area action to extract text from a specific area in an application window. You can filter the extracted text and assign it as a variable.

Note: When you use the Capture area action to extract text from a specific area in an application window and, if the target application is not responding, the bot times out after 30 seconds (default time) and displays a more detailed message including: what went wrong at line number and the corresponding corrective action to take.

To improve the accuracy of extracting text from a specific area in an application window, see this Predefined profiles specification

Follow these steps to use the Capture area action:

Procedure

  1. In the Actions palette, double-click or drag the Capture area action from the OCR package.
  2. In the Window title field, select an option:
    • Window: Captures a window on a desktop. In the Window title field, specify the application title.
    • Variable: Inserts an existing window variable.

    Insert a wildcard character (*) in the Window title field to search for window titles that can change. You can specify one or more wildcards (*) at the start, middle, or end of the value. For example, to perform an operation on any window that has Microsoft in the title, use a wildcard to indicate any string by adding it before or after the value: *Microsoft*. The bot first searches for the exact window title (Microsoft), and if it does not find a match, it searches for windows with the term Microsoft anywhere in the title.

    You can use a regular expression (regex) to identify a window title. Select the regular expression condition as either String or a Pattern and then enter the value. By default, the Window title field is case-sensitive.

    To identify a browser title, you can enable the Case sensitive option to match the letter case, or disable the option to identify a window title where the letter case does not match.
    Note: Ensure that the minimum Bot Agent version installed on your system is the version that was released with Automation 360 v.26. If you have a Bot Agent version released with Automation 360 v.25 or earlier, then by default, the window title will be identified only with matching letter case (case-sensitive).
    For example, to match all window title names beginning with a word followed by - Notepad, you can enter the String value as * -Notepad, or use Pattern value as ((\w)\s)*document-Notepad for only those window titles that match this pattern.
    Note:
    • When you use a regular expression of type String with -title as the input value for a window title in any action, the bot might encounter a run time error. To prevent the run time error, ensure that when you add the string input as *-title, the application with the specific title is open. The asterisk (*) is just a character, not a wild card character.
    • When you use a regular expression of type Pattern with -title as the input value for a window title in any action, the bot might encounter a run time error because the input value *-title is incorrect.

      Ensure that you use valid regex patterns.

  3. Optional: Select the Resize window option to specify the window dimensions.
    This option delivers a more reliable bot. It resizes the window to the dimensions at which the task was recorded, which enhances the ability of the botto identify the target object.
    • If the window is maximized when you record the task, this option is not selected.
    • If the window is not at the maximum size when you record the task, this option is selected, by default, and the width and height fields are automatically filled with the dimensions of the window.
    Note: This option is available only for windows that can be resized. It is not available for the Desktop or Taskbar options.
  4. Specify the X, Y, Width, and Height coordinates.
  5. Click Capture region.
    The bot captures text from the visible area of the screen even if the target area is below the visible screen.
  6. In the Wait before capturing the image (ms) field, specify the delay time.
    Recommendation: If you are capturing in a window that is accessed using Remote Desktop Protocol (RDP), set a minimum delay time of 1000 milliseconds to give the window time to load.
  7. Select the Filter the captured text check box to filter the captured text.
    Specify the text to filter out in the Before and After fields. For example, if the extracted text is Name: ABC Inc. Location:, to retrieve ABC Inc., you must specify Location: in the Before field and Name: in the After field.
  8. Select the Trim the captured text check box to trim the extra spaces.
  9. Select the Load Profile check box and select an option to load the locale based on the ABBYY profile:
    Note: ABBYY FineReader 12.2.27.12 is installed along with A2019 and does not require any additional setup.
    • Control Room file: Uses a file that is available on the Control Room.
    • Desktop file: Uses a file that is available on a device.
    • Variable: Uses a file variable to specify the file location.
  10. In the Select locale list, select the language of the device.
    Note: Currently, only English, Japanese, and Russian locales are supported. If you have selected an option from the Select locale list and the Load Profile option, the system considers the locale based on the Load Profile selection.
  11. In the Assign value to variable list, select a string variable.
  12. Click Save.