I’ve been trying to use the forEach command for a while now. I’ve looked at all the docs, forum posts, examples, and everything. No matter what I do, I keep running into an error: [error] Line 2: target must be an array
.
The sample code I am using:
{
"Name": "forEach",
"CreationDate": "2022-4-27",
"Commands": [
{
"Command": "executeScript_Sandbox",
"Target": "var arr = [\"Hello\",\"World\", \"2020\"]; return arr;",
"Value": "myarray",
"Description": ""
},
{
"Command": "forEach",
"Target": "myarray",
"Value": "elem",
"Description": ""
},
{
"Command": "echo",
"Target": "${elem}",
"Value": "blue",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}
The result:
I also tried this one:
{
"Name": "forEach",
"CreationDate": "2022-4-28",
"Commands": [
{
"Command": "executeScript_Sandbox",
"Target": "[\"Hello\",\"World\", \"2020\"];",
"Value": "myarray",
"Description": ""
},
{
"Command": "echo",
"Target": "${myarray}",
"Value": "",
"Description": ""
},
{
"Command": "forEach",
"Target": "myarray",
"Value": "elem",
"Description": ""
},
{
"Command": "echo",
"Target": "${elem}",
"Value": "blue",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}
and got:
So it looks like the array is never actually stored. I am using the Brave browser on Windows, so the Chrome based extension.