我是 iMacro 新手。我尝试录制一个脚本,当它出现在屏幕上时,我单击了一个弹出窗口。问题是,发布任何新事件时都会出现弹出窗口。因此,在制作脚本时它是可用的,但是当我循环脚本时它会收到错误,因为它云找不到脚本。
我的代码如下 -
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0
TAB T=2
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0
我在第一行遇到错误。
(Error code: -921)
- 如果发生任何错误,有什么方法可以重新从头开始执行吗?
- 还有什么方法可以增加循环次数?
最佳答案
如果发生任何错误,有什么方法可以重新从头开始执行吗?
答案:
解决此问题的方法是将行添加到 imacros 脚本的顶部
SET !ERRORIGNORE YES
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0
还有什么方法可以增加循环次数吗?
答案: 您需要使用 javascript 并在必要时创建无限循环,您可以通过按停止按钮结束此循环,因此我们将创建以下文件 (macro.js),而不是 imacros 文件 (macro.iim)。添加超时是因为将以 1 秒的间隔检查不同的选择器,如果需要,也可以将其设置为 0。
macro.js 文件的内容如下:
var macro;
macro= 'CODE:';
macro+= 'SET !TIMEOUT_STEP 1' + '\n';
macro+= 'SET !ERRORIGNORE YES' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0' + '\n';
while(true){
iimPlay(macro);
};
关于javascript - 在iMacro中连续寻找DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45487085/