简体   繁体   中英

How to Loop imacros if error occurs?

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)

这需要在第一行中,如果发生错误,它将忽略它并转到下一步

SET !ERRORIGNORE YES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM