我有一个在夜间运行的iMacros脚本(Firefox附加组件)。我也在使用vpn。偶尔我会收到暂停我的iMacros脚本的超时错误(-802错误)。我不确定vpn是否会导致超时错误,但这是一个不同的问题。我有另一个脚本将错误记录到谷歌表格。表格通知我有错误。然后我手动点击继续按钮,脚本继续。显然,当我睡着时,这是一个问题。
有没有办法在超时错误后自动让脚本继续?如果没有,是否有其他方法来模拟按下浏览器中的继续按钮?
以下是我用来通知我错误的代码:
var errorNotificationMacro;
errorNotificationMacro = "CODE:";
errorNotificationMacro += "URL GOTO=https://palemoon.stat.me/start \n"; // Removed r in start so the timeout error occurs
errorNotificationMacro += "TAG POS=1 TYPE=IMG ATTR=SRC:https://start.me/favicon/youtube.com \n";
errorNotificationMacro += "TAG POS=1 TYPE=SPAN ATTR=TXT:Trending \n";
macroName = "errorNotificationMacro";
returnCode = iimPlay(errorNotificationMacro);
if (returnCode < 0) {
errorNotify(macroName, returnCode);
}
/* Utilties */
// Here is the function we call when there is an error
function errorNotify(macroName, errorCode) {
iimDisplay("There was an error in the macro called " + macroName + " with this error code: " + errorCode);
fillInTheErrorForm(macroName, errorCode);
}
function fillInTheErrorForm(macroName, errorCode) {
formMacro = "CODE:";
formMacro += "TAB OPEN \n";
formMacro += "TAB T=2 \n";
formMacro += "URL GOTO=[insert URL of Google form] \n";
formMacro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mG61Hd ATTR=NAME:entry.457171507 CONTENT={{MACRONAME}} \n";
formMacro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mG61Hd ATTR=NAME:entry.1604921625 CONTENT={{ERRORCODE}} \n";
formMacro += "TAG POS=1 TYPE=CONTENT ATTR=TXT:Submit";
iimSet("MACRONAME", macroName);
iimSet("ERRORCODE", errorCode);
macroName = "formMacro";
returnCode = iimPlay(formMacro);
if (returnCode < 0) {
errorNotify(macroName, returnCode);
}
}
答案 0 :(得分:0)
为什么不使用
SET !TIMEOUT_MACRO 15
javascript中所有宏的15秒超时
<强>示例:强>
在下面的代码中,代码的超时设置为60秒,从而为宏提供更多的等待时间而不会失败。
formMacro = "CODE:";
formMacro += "TAB OPEN \n";
formMacro += "TAB T=2 \n";
formMacro += "SET !TIMEOUT_MACRO 60 \n";
formMacro += "URL GOTO=[insert URL of Google form] \n";
formMacro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mG61Hd ATTR=NAME:entry.457171507 CONTENT={{MACRONAME}} \n";
formMacro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mG61Hd ATTR=NAME:entry.1604921625 CONTENT={{ERRORCODE}} \n";
formMacro += "TAG POS=1 TYPE=CONTENT ATTR=TXT:Submit";
您可以研究的另一个选择是
SET !ERRORIGNORE YES
以便忽略超时错误。
<强>参考文献:强>
1。timeout