Javascript and imacros loop

2019-09-14 21:52发布

I made this javascript cood for imacros but is not working, i'm getting error like:

SyntaxError: wrong format of SET command, line: 1 (Error code: -910)

and i don't know what the problem. The script is suppouse to log in to account and make some submissions and log in again with another account and make the same submission
And if i have 4 account and 10 submission to make how should i edit this part of code:

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

Here is the imacros script:

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);
}

2条回答
一纸荒年 Trace。
2楼-- · 2019-09-14 22:34

try to change this

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

with this

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

and your code to this

for(i=1;i<4;i++){
iimSet("i",i);
iimPlay(login);
iimSet("i",i);
iimPlay(submit);
}
查看更多
我想做一个坏孩纸
3楼-- · 2019-09-14 22:49

why use iimSet?

why not use javascript's variable?

from this :

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

to this :

login +=  "SET !DATASOURCE_LINE " + i + " + "\n";
查看更多
登录 后发表回答