Related example macros: Demo-Datasource Script: Datasource-2-web.vbs
Create plain text file(s) that contain the information you want to submit. In this example we create two text files. One contains the information on ordering "lunch" and the other one is used for ordering "dinner".
Data source No. 1: (Data sources are located in the /datasource sub-directory of the iMacros directory)
Data source No. 2: dinner.txt could look like this:
[iOpus]
name=Tom<SP>Tester
main=1
drink=1
smallsizedrink=NO
myremarks=Deliver<SP>to<SP>home<SP>address:<BR>1629<SP>4th<SP>Avenue<BR>Thanks!<BR>Tom The iMacros file contains the location of the data files:
CMDLINE !DATASOURCE lunch.txt
TAG TYPE=INPUT:TEXT FORM=NAME:TestForm2 ATTR=NAME:Name CONTENT={{name}}
TAG TYPE=SELECT FORM=NAME:TestForm2 ATTR=NAME:main CONTENT={{main}}
TAG TYPE=SELECT FORM=NAME:TestForm2 ATTR=NAME:drink CONTENT={{drink}}
TAG TYPE=INPUT:CHECKBOX FORM=NAME:TestForm2 ATTR=NAME:C8&&VALUE:ON CONTENT={{smallsizedrink}}
TAG TYPE=TEXTAREA FORM=NAME:TestForm2 ATTR=NAME:Remarks CONTENT={{myremarks}}
During the execution of the macro, the constants in parentheses {{..}} are replaced by the value specified in the data sources. The file name of the data source is stored in the variable !DATASOURCE. This variable can be filled from the command line as well.
Tips:
Tip 1: If you want iMacros to read different values for each loop, add a number at the end of the data value name and add !LOOP to the end of the name inside the macro.
and in the macro you use:
TAG TYPE=INPUT:TEXT FORM=NAME:TestForm2 ATTR=NAME:Name CONTENT={{name!LOOP}}
TAG TYPE=SELECT FORM=NAME:TestForm2 ATTR=NAME:main CONTENT={{main!LOOP}}
You can specify the starting value of a loop with "SET !LOOP x" , where x is the number of loops.
For another example on how to loop through a larger dataset, please see the "database-2-web.vbs" example windows script. Tip 2: With the Fill and Merge Manager, you can automatically insert the {{Merge}} tags during recording.