用js循环imacro,暂停20秒,然后重新开始

时间:2013-12-13 20:59:49

标签: javascript loops imacros

我有以下js代码,但无法弄清楚如何将其暂停20秒,然后在它离开的最后位置重新开始。任何帮助都会很棒!!

var macro;
macro = "CODE:";
macro += "TAG POS={{i}} TYPE=BUTTON ATTR=CLASS:btn<SP>btn-small<SP>likebutton"    + "\n";
macro += "WAIT SECONDS=2" + "\n";
for(i=1;i<=5;i++){
if(i==5){
  macro += "WAIT SECONDS=15" + "\n";
 var i=6;
 iimPlay(macro);
}
iimSet("i",i);
 iimPlay(macro);

}

1 个答案:

答案 0 :(得分:1)

var macro;
macro = "CODE:";
macro += "TAG POS={{i}} TYPE=BUTTON ATTR=CLASS:btn<SP>btn-small<SP>likebutton"    + "\n";
macro += "WAIT SECONDS=2" + "\n";


var i=1;

while(true)
{

//pause each fifth loop
if(i%5==0)
{

iimPlay("CODE: WAIT SECONDS=20")

}
iimSet("i",i);
iimPlay(macro);

//increase counter
i++; 
}

这是循环无限循环的代码。每个第五个循环它将暂停并等待20秒。然后它将继续从下一个循环计数器开始。