Problem with if_v2

I have a problem with If_v2 .
For example we say select tab=0 and storetext and if var==5 then open tab=1 (missing “else” here but i will add it to the end because action continues in tab1) and then storeText (of tab1) and then if_v2 (of tab1) var>5 , open tab=www.cnn.com, else refresh tab1 , else (and this else is from the first if_v2) open tab=0 .So for the last “else” system appears “error the last else is not possible to be after another else”.Any solution to this?

Can you please post a short test macro?

I solved this but thank you for your help it was very complicated.Now i have another question.Is it possible to store a text as time like 00:15:20 and say to system if_v2 varNumber is higher than 00:15:20 ?

Hey :slight_smile: I want to write this
“Command”: “if_v2”,
“Target”: “{Variable1} > [{Variable2}+200]”
but not working.Is comparing only variable1 with variable2 and ignores the 200. Do you know how i should write it ? Thanks !

I tried this but not work

  • [info]

Executing: | store | ${Variable1}+200 | MixedVariable|

  • [info]

Executing: | echo | ${MixedVariable} | |

  • [echo]

100+200

This is not summary the 2 amounts but appears as 100+200

I think you must use this

1 Like

I used StoreEval instead of Store or StoreText and works ! I already used ExecuteScript which is the newer command instead of StoreEval and didnt work but StoreEval worked fine.Thank you friend !!

1 Like

If you can post the code macro will be help for the community

Here it is

{
      "Command": "storeEval",
      "Target": "${variable}+20",
      "Value": "Variable2"
    },
    {
      "Command": "echo",
      "Target": "${Variable2}",
      "Value": ""
    },
1 Like

The same solution with ExecuteScript_Sandbox would be:

{
      "Command": "ExecuteScript_Sandbox ",
      "Target": "return Number (${variable})+20;",
      "Value": "Variable2"
    },
    {
      "Command": "echo",
      "Target": "${Variable2}",
      "Value": ""
    },

The key difference is the Number keyword to make sure we treat the var content as number, not as string!

See also: If_v2 command problem

JavaScript Number() Function:

The Number() function converts the object argument to a number that represents the object’s value.

If the value cannot be converted to a legal number, NaN is returned.

Note: If the parameter is a Date object, the Number() function returns the number of milliseconds since midnight January 1, 1970 UTC.

2 Likes

Hi Thanks for reply !

Thank you very much !