Verify URL with IF


#1

Hi,

I want verify if my URL is “http://www.google.fr” but i’ve a problem :

[error] Error in runEval condition of if: Unexpected end of input

I’ve on Kantu : if | ${!URL} = “http://www.google.fr” |

I don’t understand
Thanks you


#2

I see two problems:

  • In Javascript, you need to use == for comparisons, not just =
  • enclose the variable in “…” => "${!URL}"

this macro works:

    {
      "Name": "u",
      "CreationDate": "2018-12-7",
      "Commands": [
        {
          "Command": "store",
          "Target": "http://www.google.fr",
          "Value": "u"
        },
        {
          "Command": "if",
          "Target": "\"${u}\" == \"http://www.google.fr\"",
          "Value": ""
        },
        {
          "Command": "echo",
          "Target": "ok",
          "Value": ""
        },
        {
          "Command": "endif",
          "Target": "",
          "Value": ""
        }
      ]
    }