Datasource-2-Web.vbs
From iMacros
This example shows how to submit data to a website. It calls the macro Wsh-Datasource.iim
Msgbox ("This example scripts how to submit data to a website, for example to fill an online database")
set iim1= CreateObject ("imacros")
iret = iim1.iimInit
iret = iim1.iimDisplay("Start Submission")
For num = 1 To 3
str = cstr(num) 'Convert integer to string
iret = iim1.iimDisplay("Dataset No: " + str)
sDatasource = "wsh-datasource-" + str + ".txt"
iret = iim1.iimSet("-datasource", sDatasource)
iret = iim1.iimPlay("wsh-datasource")
If iret < 0 Then
MsgBox iim1.iimGetLastError()
End If
Next
iret = iim1.iimDisplay("Done!")
iret = iim1.iimExit
Macro code for Wsh-Datasource:
VERSION BUILD=300003 'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database TAB T=1 TAB CLOSEALLOTHERS URL GOTO=http://www.iopus.com/imacros/demo/v5/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 wsh-datasource-1.txt as default value. CMDLINE !DATASOURCE wsh-datasource-1.txt ' Fill web form TAG TYPE=INPUT:TEXT FORM=NAME:TestForm ATTR=NAME:Name CONTENT={{dataset-title}} TAG TYPE=TEXTAREA FORM=NAME:TestForm ATTR=NAME:Remarks CONTENT={{dataset-item1}} ' Submit Data TAG TYPE=INPUT:SUBMIT FORM=NAME:TestForm ATTR=NAME:SendButton&&VALUE:Click<SP>to<SP>order<SP>now
