Hello, I am working on a script to automate the opening URLs on the browser, reading from a CSV file containing one URL per row, the number of URLs to be used depends on the generated number in the script, but when I want to run the script again, I want it to start from where it left off.
In the following script, I tried to save the index to a CSV file but failed, anyone can help me out? I am grateful.
I get an error of:
[error]
Line 12: No data to save to CSV
{
"Name": "Test-URL-index",
"CreationDate": "2024-12-22",
"Commands": [
{
"Command": "csvReadArray",
"Target": "url-1.csv",
"Value": "urlsArray",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "urlIndex",
"Description": ""
},
{
"Command": "csvReadArray",
"Target": "progress2.csv",
"Value": "progressArray",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "ProgIndex",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Math.floor(Math.random() * (4 - 2 + 1) + 2);",
"Value": "totalUrl",
"Description": "Generate a random number between 3 and 15 for how many comments to post"
},
{
"Command": "while_v2",
"Target": "${urlIndex} < ${totalUrl}",
"Value": "",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return ${urlsArray}[${urlIndex}][0];",
"Value": "currentUrl",
"Description": ""
},
{
"Command": "open",
"Target": "${currentUrl}",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": " URL Opened: ${currentUrl}",
"Value": "green",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number(${urlIndex}) + 1;",
"Value": "urlIndex",
"Description": ""
},
{
"Command": "echo",
"Target": "This is URL Index: ${urlIndex}",
"Value": "green",
"Description": "Output current values"
},
{
"Command": "csvSave",
"Target": "progress2.csv",
"Value": "${urlIndex}",
"Description": "Save last processed index as string"
},
{
"Command": "endWhile",
"Target": "",
"Value": "",
"Description": ""
}
]
}