If {picture} then {do this}


I have read through the help and watched all the movies but I can’t get the following to work.
if {picture} than {do this} endif

Meaning, if some popup shows than do this action to click it away.
For instance, sometimes I get :

And not every time. But when I get this message I just want to catch it and click start and ok.

But all the if and gotoif statements in the examples work with values.
Not with picture detection in a desktop environment.
How do I program this in Kantu?
Is there an example code that shows that?
Thanks in advance

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_wait to one second, so only search is done per executed visualSearch command. If you would make the command timeout e. g. 10 seconds (default), then visualSearch waits 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 use Do...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:



nobody tell you “thank you” for your help in 2019. You resolve my problem with your vidéo in 2021. So THANK YOU so much :slight_smile:


In my case even after the target element is visible it is still continuing the loop and refreshing the page. Please help.

@Biswamber_Khandei Can you share a test macro or a video of the issue?

I am not implementing this as of now. I am using !TimeoutWait