OCRExtractRelative: A larger pink box OCR area is usually better

Example: In this example we need to screen-scrape the number behind the “Type:” label (here: 0):

screen

Pink area too small => single number not OCR’ed correctly

smallpink

Pink area includes label => good OCR result

goodpink

Screen scraping video:

In this macro we test both pink areas. The small area returns “” as resul and the larger pink area returns “Type: 0” as expected.

Macro source code:

{
  "Name": "ocr2",
  "CreationDate": "2021-8-27",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://imgur.com/D7BhlEl",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "eng",
      "Value": "!OCRLanguage",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "2",
      "Value": "!OCREngine",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!OCRScale",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!OCRTableExtraction",
      "Description": ""
    },
    {
      "Command": "OCRExtractRelative",
      "Target": "toosmall2_dpi_168.png",
      "Value": "a",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Result A: ${a}",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "OCRExtractRelative",
      "Target": "larger2_dpi_168.png",
      "Value": "b",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Result B: ${b}",
      "Value": "green",
      "Description": ""
    }
  ]
}