[error] Error in executeScript_Sandbox code: Unexpected string

Hey guys, this is my second day using UI Vision and I am still just getting my feet wet. I have zero background in coding so I appreciate all and any help!

I am trying to create a simple loop counter but keep getting this error: [error] Error in executeScript_Sandbox code: Unexpected string

Can you please have a look at my code and let me know where I went wrong. Have been using the executeScript_Sandbox function since yesterday but this is my first time encountering this issue.

P.S. I wasn’t having any luck with {!loop} and {!times}, so I tried creating my own custom variable to keep count : ${myCounter}

Code:

{
“Name”: “loop-count”,
“CreationDate”: “2020-5-23”,
“Commands”: [
{
“Command”: “store”,
“Target”: “1”,
“Value”: “myCounter”
},
{
“Command”: “do”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “echo”,
“Target”: “Our current count is : {myCounter}", "Value": "green" }, { "Command": "executeScript_Sandbox", "Target": "return Number {myCounter} +1”,
“Value”: “Count”
},
{
“Command”: “repeatIf”,
“Target”: “${myCounter} < 3”,
“Value”: “Count”
}
]
}

To create a simple loop i use this code (i love simple short and fast code)

{
“Name”: “Loop_Some_Times”,
“CreationDate”: “2020-5-23”,
“Commands”: [
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorignore”
},
{
“Command”: “bringBrowserToForeground”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “0”,
“Value”: “Loop_Counter”
},
{
“Command”: “label”,
“Target”: “Engine_Code”,
“Value”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number ({Loop_Counter}) + 1", "Value": "Loop_Counter" }, { "Command": "echo", "Target": "Loop Counter Is {Loop_Counter}”,
“Value”: “#shownotification
},
{
“Command”: “gotoIf_v2”,
“Target”: “${Loop_Counter} < 5”,
“Value”: “Engine_Code”
}
]
}

Hey I appreciate the prompt response. I keep getting the error below when I paste in the code:

Unexpected token ‘“’ at 2:1
“Name”: “Loop_Some_Times”,

Nevermind I fixed it – looks like your quote symbols appear different from mine.

I fixed that and added a few $ here and there and it works! Thanks again :slight_smile:

It’s a bug of the forum the format, I pasted correct code but the forum have an error in format of code, the code works i use it.

1 Like