Get control text by OCR

Learn how to develop your script to get control text from an anchor image. You need to use the Get Control Text by OCR command to get control text by OCR.

Before you begin

This procedure assumes that you read the considerations to configure your environment for surface automation.

  • Product requirements
    IBM RPA Studio license

  • User requirements

    • Permission to use IBM RPA Studio application
    • Permission to create or manage a script

Also, to reproduce the example in the following video, add the Launch and Attach Window command to your script to open the Paint application.

Procedure

The following video shows how to use the IBM RPA Studio’s recorder to map the Edit colors button icon and get its text from the Paint application.

Note: The video has no narration.

The following steps describe how you can snip images by using the IBM RPA Studio’s recorder, and get a text with the Get Control Text by OCR command according to the previous video.

  1. Start the IBM RPA Studio's recorder.
  2. On the Paint application, with the cursor over the Edit colors menu, press the Ctrl key.
  3. After the region is highlighted in green, go to the recorder bar, and select Actions > Get Control Text by OCR > Auto Suggest.
  4. In the OCR Click Preview window, you can click the Preview icon to search for the text on the image. Then, click Save.

The Get Control Text by OCR command window opens filled with the main input parameters based on the actions that you selected in the previous steps. The following sample image shows that parameters:

The Get Control Text by OCR command with the main input parameters to get the text in the computer's screen.

  • Language: English (United States).
  • OCR Provider: Abbyy.
  • Similarity Degree: 100% of similarity degree to reach the text in the screen.
  • Selector: Name.
  • Name: Edit colors.
  • Text: The output parameter stores the text that is obtained.

Getting control text by OCR with Screen Capture Tool

Alternatively, you can drag the Get Control Text by OCR command to your script from the toolbox, use the IBM RPA Studio’s recorder to map the text's control, or use the Screen Capture Tool.

If you choose the Screen Capture Tool to snip an image to get a text, you need to select the Get text from the selected image option.

The recorder opened recording the "Edit colors" button on the Paint application, and selecting the "Get text from the selected image" option.