gpt4 book ai didi

javascript - 如果发生错误如何循环imacros?

转载 作者:行者123 更新时间:2023-11-28 01:39:45 25 4
gpt4 key购买 nike

我正在尝试运行一个简单的脚本,一遍又一遍地循环imacros,但如果链接不存在,则继续下一个循环,但如果链接确实存在,则只需像往常一样继续运行imacros。

这是我制作的非常基本的脚本。这是我的 imacros 版本

 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

这是我的 JavaScript 版本。

 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

关于javascript - 如果发生错误如何循环imacros?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21061040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com