Run if or while command constantly

On a website that I am running my script on, a popup from the website comes up randomly. I want to click to the OK button anytime it pops up, but I don’t see how to do that. I tried the following code, but it just goes in a loop forever without going on.

 {
  "Command": "while",
  "Target": "100>5",
  "Value": ""
},
{
  "Command": "visualAssert",
  "Target": "AwX7QI_dpi_144.png",
  "Value": ""
},
{
  "Command": "click",
  "Target": "#efp",
  "Value": ""
},
{
  "Command": "endWhile",
  "Target": "",
  "Value": ""

Multi-tasking in Kantu would be a cool feature, but it is not available yet. But what you can do is to distribute checks all other your macro - on every place where the popup could appear:

  • store | true | !errorignore [so the macro does not stop if the image is not there]
  • visualAssert | AwX7QI_dpi_144.png
  • click | #efp
  • store | false | !errorignore [back to normal…]

Second option: Use the command line, and check the return value. If the macro stops with an error, you can run another macro that closes the dialog, and then continue.