Looping through array of characters (VBS)

Information related to the use of iMacros for form filling and data upload.

Moderator: iMacros Moderators

Looping through array of characters (VBS)

by Hannes, Tech Support on Mon Sep 29, 2008 2: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
Hannes, iOpus Support
Hannes, Tech Support
 
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am

Return to How-To's and Examples for Form Filling

Who is online

Users browsing this forum: No registered users and 1 guest

-->