Jump to content
Sign in to follow this  

how to loop through all items returned by _IEFormGetCollection

Recommended Posts


I am very new to autoit, please forgive what I suspect is a simple questiopn...

Given this code:

$oIE = _IECreate ("http://www.example.com"); some example site with a form on it
$oForm = _IEFormGetCollection ($oIE, 0)

how can I loop through the collection so as to figure out what to use in _IEFormElementGetCollection so that I hit the correct input box? I am having trouble getting anything to fill in, I've started at zero and worked my way to 15 on the second parameter in _IEFormElementGetCollection. Thanks in advance.


Share this post

Link to post
Share on other sites

Get them all with the default index of -1, then just use a For/In/Next loop to walk through them:

$colForms = _IEFormGetCollection($oIE) ; -1 is the default index
For $oForm In $colForms
     ; ... do stuff here with $oForm



Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

Welcolme to the forum ! Posted Image

Try this it can help you to find the good way...

#include <IE.au3>

$oIE = _IECreate ( $Url, 0, 0, 1 )
$oForms = _IEFormGetCollection ( $oIE )
For $oForm In $oForms
    ConsoleWrite ( "->--- Form name : " & $oForm.name & " Form method : " & $oForm.method & " Form action : " & $oForm.action & @CRLF ) 
    $index = 0
    $oFormElements = _IEFormElementGetCollection ( $oForm )
    For $oFormElement In $oFormElements
        ConsoleWrite ( "!>---           FormElement Index : " & $index & " FormElement Name : " & $oFormElement.name & " FormElement Type : " & $oFormElement.type & " FormElement Id : " & $oFormElement.Id & @CRLF )
        $index += 1

_IEQuit ( $oIE )
Edited by wakillon

AutoIt X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...