Repeat loop if text isn't found in box

Hi all!

I’m working on a macro but I need a loop to run until it finds a certain code in a certain text box, and then switch to running the rest of the instruction. Any idea how I could accomplish this? I’m fairly new to this but got 2 macros working to make my life a whole lot easier next week so now it’s time to tackle something a little harder.

Basically I want the loop to get to a page, hit a button that says “Last” and then hit a back arrow until it find “WXYZ” in one certain text box. Once it does, I want it to continue on with the rest of the plan.

Use storeValue to get the text from the box, and Do…RepeatIf for the loop:

This works - it loops until you enter “test” as name:

{
  "Name": "storevalue",
  "CreationDate": "2021-9-7",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://ui.vision/contact",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "do",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeValue",
      "Target": "id=ContactName",
      "Value": "name",
      "Description": ""
    },
    {
      "Command": "repeatIf",
      "Target": "${name} != \"test\"",
      "Value": "",
      "Description": "Type \"test\" in the name field to break the loop"
    },
    {
      "Command": "echo",
      "Target": "Done!",
      "Value": "green",
      "Description": ""
    }
  ]
}

PS: Same as here: Stop macro execution command if string is found on website - #4 by ulrich (the only difference is here we use storeValue, and there storeText)

1 Like

Super helpful!

If I wanted to just go back to line 11 and loop from there to keep checking for the group?

  • Move Line 11 inside the DO… REPEAT IF loop

  • Or: To jump around, use the LABEL and then the GOTO LABEL commands

In general, to check if a command was ok use the !status_ok internal variable

Moved 11 inside the do/repeatif loop but it’s still just jumping straight back up to reading the csv file and trying to go fully on to the next entry.