Demo-Datasource

From iMacros

Jump to: navigation, search

Read data from from textfile (in CSV format) and enter it into web form.

VERSION BUILD=320028
TAB T=1     
TAB CLOSEALLOTHERS     
'This example macro uses the LOOP function and a datasource to submit several datasets to a website.
'For other ways to submit data to websites, please see the powerful "database-2-web.vbs" Windows script
URL GOTO=http://www.iopus.com/imacros/demo/v6/f1/form.asp
' The folling line is only a safeguard. If the macro is NOT started with a command line or script parameter
' it takes the datasource-loop.txt  as default value.
'!LOOP is automatically replaced by the current value of the loop counter e.g 1,2,3,...
CMDLINE !DATASOURCE datasource-loop.txt 
' Fill web form 
'Do not encrypt/decrypt given password
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:TestForm ATTR=NAME:Name CONTENT={{title!LOOP}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:TestForm ATTR=NAME:Remarks CONTENT={{item!LOOP}}
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:TestForm ATTR=NAME:Customer&&VALUE:Yes CONTENT=Yes 
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:TestForm ATTR=NAME:Reg_code CONTENT={{password}}
' Submit Data
TAG  POS=1 TYPE=INPUT:SUBMIT FORM=NAME:TestForm ATTR=NAME:SendButton&&VALUE:Click<SP>to<SP>order<SP>now