如何设置iMacros的循环?(How to set a loop in iMacros?)

2019-09-27 16:43发布

我已经写了一个宏给出如下─

VERSION BUILD=844 RECORDER=CR
URL GOTO=https://example.com/form.aspx
WAIT SECONDS= 4

EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(4)>TABLE:nth-of-type(2)>TBODY>TR:nth-of-type(195)>TD:nth-of-type(4)>SPAN:nth-of-type(2)>I" BUTTON=0
WAIT SECONDS= 15
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(4)>TABLE:nth-of-type(2)>TBODY>TR:nth-of-type(196)>TD:nth-of-type(4)>SPAN:nth-of-type(2)>I" BUTTON=0
WAIT SECONDS= 15
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(4)>TABLE:nth-of-type(2)>TBODY>TR:nth-of-type(197)>TD:nth-of-type(4)>SPAN:nth-of-type(2)>I" BUTTON=0
WAIT SECONDS= 15
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(4)>TABLE:nth-of-type(2)>TBODY>TR:nth-of-type(198)>TD:nth-of-type(4)>SPAN:nth-of-type(2)>I" BUTTON=0
WAIT SECONDS= 15
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(4)>TABLE:nth-of-type(2)>TBODY>TR:nth-of-type(199)>TD:nth-of-type(4)>SPAN:nth-of-type(2)>I" BUTTON=0
WAIT SECONDS= 15

在循环的每次迭代中,仅在​​值“TBODY> TR:第n的式(XXX)”的变化。 XXX的取值范围从1到150,我应该如何转换成一个圈这个以减少行代码,提高可读性。

一些研究之后,我发现!LOOP功能可以在iMacros都可以使用,但我无法避开它的语法。 帮我个忙,请。

Answer 1:

尝试反复播放这个宏
(电流:1最大值:150, '播放循环' 按钮):

SET url https://example.com/form.aspx
SET url EVAL("({{!LOOP}} == 1) ? '{{url}}' : 'javascript: undefined;';")
URL GOTO={{url}}
SET firstWait EVAL("({{!LOOP}} == 1) ? '4' : '0';")
WAIT SECONDS={{firstWait}}

EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV:nth-of-type(4)>TABLE:nth-of-type(2)>TBODY>TR:nth-of-type({{!LOOP}})>TD:nth-of-type(4)>SPAN:nth-of-type(2)>I" BUTTON=0
WAIT SECONDS=15


文章来源: How to set a loop in iMacros?