This is a great question so I made a short screencast to show it:
In a nutshell, you:
-
Use visualSearch to search for image. I reduced
!timeout_waitto one second, so only search is done per executedvisualSearchcommand. If you would make the command timeout e. g. 10 seconds (default), thenvisualSearchwaits for 10 seconds to see if the image might show up. It does one image search per second. The number of found images is stored in the variable. -
Use IF to check on the result of
visualSearch. Here we useDo...RepeatIf, so we stay in the loop until the image is found.
Macro code:
{
"Name": "If IMAGE do THIS",
"CreationDate": "2019-9-5",
"Commands": [
{
"Command": "store",
"Target": "1",
"Value": "!timeout_wait"
},
{
"Command": "do",
"Target": "",
"Value": ""
},
{
"Command": "visualSearch",
"Target": "taskbar_open_dpi_96.png",
"Value": "found"
},
{
"Command": "repeatIf",
"Target": "${found} == 0",
"Value": ""
},
{
"Command": "echo",
"Target": "Image found! (${found})",
"Value": "#shownotification"
}
]
}
Search input image:
