Imacros如何启用无限循环?

时间:2013-11-12 11:28:19

标签: loops infinite imacros

我刚开始使用imacro,但我不知道如何设置无限循环。

我的代码是:

set !loop 3
VERSION BUILD=8530828 RECORDER=FX
TAB T=1
REFRESH
TAG POS=3 TYPE=A ATTR=TXT:Like
TAB T=2
WAIT SECONDS=3
TAG POS=1 TYPE=LABEL ATTR=ID:timelineHeadlineLikeButton
WAIT SECONDS=2
TAB CLOSE
TAB T=1
WAIT SECONDS=5

set !loop 3
VERSION BUILD=8530828 RECORDER=FX
TAB T=1
REFRESH
TAG POS=3 TYPE=A ATTR=TXT:Like
TAB T=2
WAIT SECONDS=3
TAG POS=1 TYPE=LABEL ATTR=ID:timelineHeadlineLikeButton
WAIT SECONDS=2
TAB CLOSE
TAB T=1
WAIT SECONDS=5

4 个答案:

答案 0 :(得分:1)

SET !VAR1 3
SET !VAR2 {{!LOOP}}
ADD !VAR1 -{{!VAR2}}
TAB T={{!VAR1}}

(3表示2因为循环不能设置0) 或者:

SET !VAR1 2
SET !VAR1 {{!LOOP}}
ADD !VAR1 {{!LOOP}}
ADD !VAR1 -1
TAB T={{!VAR1}}

答案 1 :(得分:1)

循环使用Javascript:

var loop;
function play(loop) {
        for (i=0;i<loop,i++;) {
            iimPlay("macro.iim"); //Play Your Macro
}
}
play(999); //loops macro 999 times

您也可以遍历宏中的数据数组:

var loop;
var dataline;
function play(dataline,loop) {
        for (i=0;i<loop,i++;) {
            iimSet("dataline",dataline);  //set dataline (optional)
            iimPlay("macro.iim"); //Play Your Macro
}
}
play(3,999); //starts on datasource line 3 loops 999 times

然后在.iim文件中

SET !DATASOURCE Address.csv //your csv datasource file
SET !DATASOURCE_LINE {{dataline}}  //start on that line
TAG POS=1 TYPE=INPUT:TEXT CONTENT={{!COL1}}  //1st line of your spreadsheet

享受!

答案 2 :(得分:-1)

只需使用Play(循环)按钮运行它,在最大框中显示非常大的数字

TAB T=1
REFRESH
TAG POS=3 TYPE=A ATTR=TXT:Like
TAB T=2
WAIT SECONDS=3
TAG POS=1 TYPE=LABEL ATTR=ID:timelineHeadlineLikeButton
WAIT SECONDS=2
TAB CLOSE
TAB T=1
WAIT SECONDS=5

答案 3 :(得分:-1)

这是一个无限循环,可以在每个循环之间发出警报并中断错误并等待10秒:

function play() {
    for (i=1;i>0,i++;) {
        iimPlay("macro.iim"); //Play Your Macro
        if (iimGetErrorText()!="OK") {  //if there is an error
            alert(iimGetErrorText()); //alert the error
            break;  //break loop on error
        }
        iimPlayCode("WAIT SECONDS=10"); //Wait 10 Seconds between each loop
    }
}
play();