My stored text is working fine. I can use an IF/Elseif with the ${txt}.includes("test") but want to include more terms

In the new Ui.Vision versions the above macro returns " undefined is not a function" because since Ui.Vision Version 8+ you need to use .LastIndexOf of instead of .includes inside executescript_sandbox.

This modified macro works fine:

{
  "Name": "lastIndexOf",
  "CreationDate": "2023-5-11",
  "Commands": [
    {
      "Command": "store",
      "Target": "3 months 5 months one year",
      "Value": "a",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "3 months 11 months one year",
      "Value": "a",
      "Description": ""
    },
    {
      "Command": "if",
      "Target": "${a}.lastIndexOf(\"3 months\") > -1 && ${a}.lastIndexOf(\"5 months\") == -1",
      "Value": "",
      "Description": "short version with ! operator"
    },
    {
      "Command": "echo",
      "Target": "string contains “3 months” but ‘does not contain’ “5 months”",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "else",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "NOT found!",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}