2017-10-17 97 views
0

我想在iMacros中做一些腳本,但我似乎無法弄清楚它們的循環結構是如何工作的。通常在一個循環中,您可以進行某種評估,也可以進行某種計數,並在代碼中使用明確的開始和停止指示符。我沒有拿起如何循環在iMacros工作。我之前從未在iMacros上做過任何工作,並且他們在網上發佈了很多東西,發現完整,最新,相關信息困難。我找到了一些相關的鏈接,但沒有解釋其語法的初學者指南。例如,其中一個教程視頻在6個版本之前,並具有不同的品牌。循環如何在iMacros中工作?

我發現example for loops,它並沒有幫助我理解它們是如何工作的。如果我已經理解了iMacros的語法,這可能會有所幫助,但這可能是有幫助的。但是這是一個捕獲22.

我見過一些所以,帖子提到某種「Play Loop」按鈕,我沒有在評估中版。那還是一件事嗎?從示例頁面

代碼:

VERSION BUILD=10.4.28.1074 
'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database 
TAB T=1  
TAB CLOSEALLOTHERS 
' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file 
'CSV = Comma Separated Values in each line of the file 
SET !DATASOURCE Address.csv 
'Start at line 2 to skip the header in the file 
SET !LOOP 2 
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}} 
' Fill web form 
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:fname CONTENT={{!COL1}} 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:lname CONTENT={{!COL2}} 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:address CONTENT={{!COL3}} 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:city CONTENT={{!COL4}} 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:zip CONTENT={{!COL5}} 
' 
'Note * is used to ignore leading and trailing blanks that could be in the input data 
' 
'The precent (%) symbol is used to select the stateid by VALUE as defined in the website select statement and not by its index. 
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:state CONTENT=$*{{!COL6}}* 
' 
'The string ($) symbol is used to select the country by TEXT, not by its index. 
'Index would be the position of an entry in the combo box list, e. g. 161 for United States 
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:country CONTENT=$*{{!COL7}}* 
' 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:email CONTENT={{!COL8}} 
TAG POS=1 TYPE=BUTTON:submit FORM=ID:demo ATTR=TXT:Submit 

TAG POS=1 TYPE=A ATTR=TXT:*Back* 

回答

0

我沒有拿起如何在iMacros的循環工作。

的iMacros通過循環完整的宏循環工作 - 你先從LOOP按鈕,而不是PLAY按鈕宏。

通常在一個循環中,您可以進行某種評估,可能是某種計數,並且在代碼中有清晰的開始和停止指示符。

沒有這一切。你所擁有的是包含當前循環值的{!LOOP}變量。這就是你的宏在這裏實際使用的內容

SET !DATASOURCE_LINE {{!LOOP}} 

要逐行讀取CSV文件。