2014-01-24 136 views
0

我做這個JavaScript COOD爲iMacros的,但不能正常工作,我得到錯誤,如:Javascript和iMacros的循環

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

,我不知道是什麼問題。 該腳本是支持登錄帳戶,並提交一些提交,並再次登錄與另一個帳戶,並提交相同的提示
如果我有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); 
} 

回答

0

嘗試改變這種

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

它給了我一組相同的錯誤,並引發ReferenceError:n是沒有定義,行:4(錯誤代碼:991) – Lorand

+0

從這個

不一樣的錯誤。檢查你的sintax – Bestmacros

+0

是的,你是對的,但我無法弄清楚他們的工作有何分別 – Lorand

0

爲什麼要用iimSet?

爲什麼不使用javascript的變量?

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

這樣::

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