Using an If to check that a string contains a certain substring

Update: Since UI.Vision Version 4 and newer, the easier solution is to use executeScript command and the Javascript .includes feature to check that a string contains a certain substring (“string comparison”):

2025 Note: Do not use .includes. Use .LastIndexOf instead.

{
  "Name": "includes",
  "CreationDate": "2022-6-24",
  "Commands": [
    {
      "Command": "store",
      "Target": "test tim meyer",
      "Value": "e"
    },
    {
      "Command": "if",
      "Target": "${e}.includes (\"tim\") == true",
      "Value": "2025 NOTE: .includes is outdated!!! See the correct solution below"
    },
    {
      "Command": "echo",
      "Target": "yes, it contains this string",
      "Value": "blue"
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}