2017-10-17 91 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文件。