Select the last item option on a menu

You can start with a “too high” index and then reduce the index until !statusOK is true. Demo:

{
  "Name": "Select LAST entry",
  "CreationDate": "2020-12-23",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://ui.vision/contact",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "comment",
      "Target": "i is the MAX. expected number of entries",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "10",
      "Value": "i"
    },
    {
      "Command": "do",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusok"
    },
    {
      "Command": "select",
      "Target": "id=WhatSoftware",
      "Value": "index=${i}"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (${i}) - 1;",
      "Value": "i"
    },
    {
      "Command": "repeatIf",
      "Target": "${!statusOk} == false",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Done! Selected LAST index = ${i}",
      "Value": "blue"
    }
  ]
}
2 Likes