Input from List of Variables File
Top  Previous  Next

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)

lunch.txt could look like this:

[iOpus] 
name=Mr.<SP>Tester 
main
=2 drink=2 
smallsizedrink
=NO 
myremarks
=Deliver<SP>to<SP>office
   
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.

Example: The datasource can look like:

[iOpus] 
name1
=Tom<SP>Tester 
name2
=Ann<SP>Smith 
name3
=Nicole<SP>Frank 
main
1=2 
main
2=1 
main
3=3 

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.







Page URL http://www.iopus.com/imacros/help/listofvariablesformat.htm