How can I 'OR' a search?

Sometimes you need to do something if image A or image B appears. For example, you wait for dialog box A or B.

The solution is to store the visualSearch image search result for each image in a variable, and then use standard Javascript || to “OR” it. In the test below in the first run no image is found, then one, and finally both:

macro:

{
  "Name": "OR search",
  "CreationDate": "2021-3-18",
  "Commands": [
    {
      "Command": "store",
      "Target": "3",
      "Value": "!timeout_wait"
    },
    {
      "Command": "visualSearch",
      "Target": "logo_dpi_168.png",
      "Value": "a"
    },
    {
      "Command": "visualSearch",
      "Target": "rpa_dpi_168.png@0.8",
      "Value": "b"
    },
    {
      "Command": "echo",
      "Target": "a=${a} b=${b}",
      "Value": ""
    },
    {
      "Command": "if_v2",
      "Target": "Number (${a}) > 0 || Number (${b}) > 0",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "A and/or B are found!",
      "Value": "green"
    },
    {
      "Command": "else",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "No image found!",
      "Value": "blue"
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}