Reputation: 51
im trying to run a simple script, loop an imacros over and over but if a link does not exist then move on to the next loop but if the link does exist then just keep running imacros as usual.
This is the script I have made very basic. This is my imacros version
VERSION BUILD=8601111 RECORDER=FXSET
!DATASOURCE check.csv
TAB T=1
URL GOTO=http://{{!COL1}}.blogspot.com/
TAG POS=2 TYPE=A ATTR=HREF:http://{{!COL1}}.blogspot.com/
'if fail start next loop, if not fail keep running macros
ADD !EXTRACT {{!COL1}}
SAVEAS TYPE=EXTRACT FOLDER=c:\iMacros FILE=table.csv
This is my javascript version.
const iterations = 100; // Number of times to loop
var macro;
macro = "CODE:";
macro += "VERSION BUILD=8300326 RECORDER=FX" + "\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "SET !DATASOURCE check.csv" + "\n";
macro += "SET !LOOP 8" + "\n";
macro += "SET !DATASOURCE_COLUMNS 3" + "\n";
macro += "set !var1 1" + "\n";
macro += "add !var1 {{!loop}}" + "\n";
macro += "SET !DATASOURCE_LINE {{!var1}}" + "\n";
macro += "TAB T=1" + "\n";
macro += "URL GOTO=http://{{!COL1}}.blogspot.com/" + "\n";
macro += "SET !ERRORIGNORE NO" + "\n";
macro += "TAG POS=2 TYPE=A ATTR=HREF:http://{{!COL1}}.blogspot.com/" + "\n";
'if link fail start next loop, if not fail keep running macros
macro += "ADD !EXTRACT {{!COL1}}" + "\n";
macro += "SAVEAS TYPE=EXTRACT FOLDER=c:\iMacros FILE=table.csv" + "\n";
iimPlay(macro)
Upvotes: 1
Views: 7432
Reputation: 2243
This needs to be in the first line, if an error occures, it will ignore it an goes to the next step
SET !ERRORIGNORE YES
Upvotes: 1