如何正确使用循环

时间:2015-10-03 12:42:33

标签: imacros

我有邀请朋友加入FB群组的朋友,朋友名字取自CSV文件,所以我需要写循环,而不是邀请所有人来自csv文件。这是我的宏

var macro,start;
macro =  "CODE:";
macro +=  "SET !ERRORIGNORE YES" + "\n"; 
macro +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
macro +=  "SET !DATASOURCE FB<SP>Groups.csv" + "\n"; 
macro +=  "SET !DATASOURCE_COLUMNS 1000" + "\n"; 
macro +=  "SET !LOOP 1" + "\n"; 
macro +=  "SET !DATASOURCE_LINE {{!LOOP}}" + "\n"; 
macro +=  "URL GOTO=" + "\n"; 
macro +=  "TAG POS=1 TYPE=I ATTR=CLASS:" + "\n"; 

所以我想从这里开始循环

macro +=  "TAG POS=2 TYPE=SPAN ATTR=TXT:Invite<SP>Friends" + "\n"; 
macro +=  "SET !DATASOURCE FB<SP>Users.csv" + "\n"; 
macro +=  "SET !DATASOURCE_COLUMNS 1000" + "\n"; 
macro +=  "SET !LOOP 1" + "\n"; 
macro +=  "SET !DATASOURCE_LINE {{!LOOP}}" + "\n"; 
macro +=  "TAG POS=1 TYPE=INPUT:TEXT ATTR=CLASS:" + "\n"; 
macro +=  "TAG POS=1 TYPE=SPAN ATTR=CLASS:uiButtonText" + "\n"; 
iimPlay(macro)

1 个答案:

答案 0 :(得分:1)

使用此代码段播放:

<zoo install>/conf/zoo.cfg

希望,你能抓住这个想法。

以下是一种如何定义csv文件中的行数的方法:

var macro = "CODE:";
for (i = 1; i <= 3; i++) {
    macro +=  "SET !DATASOURCE FB<SP>Users.csv" + "\n"; 
    macro +=  "SET !DATASOURCE_LINE " + i + "\n"; 
    macro +=  "PROMPT {{!COL1}}" + "\n"; 
    iimPlay(macro);
}