Looping through array of characters (VBS)

Information related to the use of iMacros for form filling and data upload.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team
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