Please help, i don’t know how to check if a variable contains a value
This is example of previous version of my code. It worked fine before updating
{
"Name": "2",
"CreationDate": "2024-5-2",
"Commands": [
{
"Command": "store",
"Target": "X",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "text",
"Value": "X",
"Description": ""
},
{
"Command": "echo",
"Target": "${X}",
"Value": "green",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${X}.contains (\"text\") ",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "found",
"Value": "green",
"Description": ""
},
{
"Command": "else",
"Target": "not found",
"Value": "red",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}
Now i trying to use “if” but still cant start macros.
* [info]
Executing: | store | X | |
* [info]
Executing: | store | text | X |
* [info]
Executing: | echo | ${X} | green |
* [echo]
text
* [info]
Executing: | if | ${X}.includes ("text") | |
* [error]
[Line 4](moz-extension://fda11581-9ac7-47b5-abae-28699ca9ab03/popup.html?from=bookmark#): undefined is not a function
* [info]
Macro failed (Runtime 1.21s)
Also I can’t use this:
{
"Command": "executeScript_Sandbox",
"Target": "if (${X}.indexOf('text') > -1) { 'found' } else { 'not found' }",
"Value": "output",
"Description": ""
},
{
"Command": "echo",
"Target": "${output}",
"Value": "green",
"Description": ""
}
(undefined is not a function)
or this
{
"Command": "executeScript_Sandbox",
"Target": "if (${X}.indexOf('text') > -1) { 'found' } else { 'not found' }",
"Value": "output",
"Description": ""
},
{
"Command": "echo",
"Target": "${output}",
"Value": "green",
"Description": ""
}
(can’t convert undefined to object)
...
{
"Command": "if",
"Target": "${X}.indexOf(\"text\")",
"Value": "",
"Description": ""
},
...
not working correctly too