OCRExtract error "Cannot read properties of null"

OCRExtract has been deprecated. Instead we have a new command called OCRExtractScreenshot. What this command does is that it it looks for input images in the “Screenshot” tab of Ui.Vision => Now you can OCR process any downloaded image or screenshot. Every image that is shown in the “Screenshot” tab can be used as input.

To clarify further:

  • OCRExtractRelative and OCRExtractByTextRelative look in the browser (or desktop, when in desktop automation mode) for the area to read text from.

  • OCRExtractScreenshot looks at images in the screenshot tab of Ui.Vision to read text from.

OCRExtractScreenshot Demo macro:

{
  "Name": "ImageTextExtract",
  "CreationDate": "2024-6-11",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://ui.vision/",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "99",
      "Value": "!ocrengine",
      "Description": "Built-in OCR Engines: 99=xmodule, 98=Javascript"
    },
    {
      "Command": "storeImage",
      "Target": "xpath=//*[@id=\"logo\"]/img",
      "Value": "logo.png",
      "Description": "Save image"
    },
    {
      "Command": "OCRExtractScreenshot",
      "Target": "logo.png",
      "Value": "a",
      "Description": "Run OCR on the saved image"
    },
    {
      "Command": "echo",
      "Target": "Text in image: ${a}",
      "Value": "green",
      "Description": ""
    }
  ]
}
3 Likes