Looping through array of characters (VBS)

Information related to the use of iMacros for form filling and data upload.
Post Reply
Hannes, Tech Support

Looping through array of characters (VBS)

Post by Hannes, Tech Support » Mon Sep 29, 2008 9:13 am

If a web form needs to be queried for "a", "b", "c", ..., the following VBS script will show give you all the necessary steps:

Code: Select all

Option Explicit

'initiate iMacros instance 
Dim iim1, iret
set iim1 = CreateObject ("imacros")
iret = iim1.iimInit()

Dim myArray, recentChar, macro
myArray=Array("a","b","c","d","e") ' may need to be completed :-)

for each recentChar in myArray
	macro = "CODE:"
	macro = macro + "TAB T=1     " + vbNewLine
	macro = macro + "TAB CLOSEALLOTHERS     " + vbNewLine
	macro = macro + "URL GOTO=http://www.google.com/     " + vbNewLine
	'######
	' here we use the loop's character directly in the macro
	'######
	macro = macro + "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT=" + Cstr(recentChar) + vbNewLine
	macro = macro + "TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG  "
	iret = iim1.iimPlay(macro)
next
Post Reply