Javascript和iMacros的环(Javascript and imacros loop)

2019-10-30 11:05发布

我做了这个JavaScript COOD为iMacros的,但不能正常工作,我得到错误,如:

语法错误:SET指令,行的错误格式:1(错误代码:-910)

我不知道是什么的问题。 该脚本是suppouse登录账户,并提出一些意见,并与其他帐户再次登录并进行相同的提交
如果我有4个帐户,并提交10使我应该怎么修改这部分代码:

 iimPlay(login);
    for(i=1;i<4;i++){
    iimSet("i",i);
    iimPlay(submit);
    }

这里是iMacros的脚本:

var login;
    login =  "CODE:";
    login +=  "VERSION BUILD=7601105" + "\n";
    login +=  "CLEAR" + "\n";
    login +=  "TAB T=1" + "\n";
    login +=  "SET !DATASOURCE D:\test\iftt-login.csv" + "\n";
    login +=  "SET !DATASOURCE_COLUMNS 2" + "\n";
    login +=  "SET !DATASOURCE_LINE {{i}}" + "\n";
    login +=  "URL GOTO=https://ifttt.com/login" + "\n";
    login +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/session ATTR=NAME:login CONTENT={{!COL1}}" + "\n";
    login +=  "SET !ENCRYPTION NO" + "\n";
    login +=  "TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:/session ATTR=NAME:password CONTENT={{!COL2}}" + "\n";
    login +=  "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/session ATTR=NAME:remember_me CONTENT=NO" + "\n";
    login +=  "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/session ATTR=NAME:commit" + "\n";

var submit;
 submit =  "CODE:";
 submit +=  "SET !DATASOURCE D:\tumblr\stuff-to-submit.csv" + "\n";
 submit +=  "SET !DATASOURCE_COLUMNS 3" + "\n";
 submit +=  "SET !DATASOURCE_LINE {{n}}" + "\n";
 submit +=  "URL GOTO=https://ifttt.com/myrecipes/personal/new" + "\n";
 submit +=  "TAG POS=1 TYPE=A ATTR=TXT:this" + "\n";
 submit +=  "TAG POS=1 TYPE=IMG ATTR=ID:channel_4" + "\n";
 submit +=  "TAG POS=1 TYPE=H3 ATTR=TXT:New<SP>feed<SP>item" + "\n";
 submit +=  "SET !ERRORIGNORE YES" + "\n";
 submit +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:new_statement ATTR=ID:statement_live_trigger_attributes_live_trigger_fields_attributes_0_string_value CONTENT={{!COL1}}" + "\n";
 submit +=  "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:new_statement ATTR=ID:validate_trigger_btn" + "\n";
 submit +=  "TAG POS=1 TYPE=A ATTR=TXT:that" + "\n";
 submit +=  "TAG POS=2 TYPE=IMG ATTR=ID:channel_13" + "\n";
 submit +=  "SET !ERRORIGNORE NO" + "\n";
 submit +=  "TAG POS=1 TYPE=H3 ATTR=TXT:Create<SP>a<SP>photo<SP>post" + "\n";
 submit +=  "TAG POS=1 TYPE=TEXTAREA FORM=ID:new_statement ATTR=ID:statement_live_action_attributes_live_action_fields_attributes_1_value CONTENT=" + "\n";
 submit +=  "TAG POS=1 TYPE=DIV ATTR=TXT:Complete<SP>Action<SP>Fieldsstep<SP>6<SP>of<SP>7Create<SP>a*" + "\n";
 submit +=  "TAG POS=1 TYPE=TEXTAREA FORM=ID:new_statement ATTR=ID:statement_live_action_attributes_live_action_fields_attributes_1_value CONTENT={{!COL2}}" + "\n";
 submit +=  "TAG POS=1 TYPE=TEXTAREA FORM=ID:new_statement ATTR=ID:statement_live_action_attributes_live_action_fields_attributes_2_value CONTENT={{!COL3}}" + "\n";
 submit +=  "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:new_statement ATTR=ID:validate_action_btn" + "\n";
 submit +=  "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:new_statement ATTR=ID:statement_create_task_submit" + "\n";

iimPlay(login);
for(i=1;i<4;i++){
iimSet("i",i);
iimPlay(submit);
}

Answer 1:

试图改变这个

login +=  "SET !DATASOURCE_LINE {{!LOOP}}" + "\n";

有了这个

login +=  "SET !DATASOURCE_LINE {{i}}" + "\n";

和你的代码本

for(i=1;i<4;i++){
iimSet("i",i);
iimPlay(login);
iimSet("i",i);
iimPlay(submit);
}


Answer 2:

为什么要使用iimSet?

为什么不使用JavaScript的变量?

由此 :

login +=  "SET !DATASOURCE_LINE {{i}}" + "\n";

为此:

login +=  "SET !DATASOURCE_LINE " + i + " + "\n";


文章来源: Javascript and imacros loop