Function Reference


_IEFormGetCollection

Returns a collection object variable representing the Forms in the document or a single form by index

#include <IE.au3>
_IEFormGetCollection ( ByRef $oObject [, $iIndex = -1] )

Parameters

$oObject Object variable of an InternetExplorer.Application, Window, Frame or iFrame object
$iIndex [optional] specifies whether to return a collection or indexed instance
 0 or positive integer returns an indexed instance
-1 = (Default) returns a collection

Return Value

Success: an object variable with a collection of all forms in the document, @extended = form count.
Failure: sets the @error flag to non-zero.
@error: 3 ($_IEStatus_InvalidDataType) - Invalid Data Type
5 ($_IEStatus_InvalidValue) - Invalid Value
7 ($_IEStatus_NoMatch) - No Match
@extended: Contains invalid parameter number

Related

_IEFormGetObjByName, _IEFormReset, _IEFormSubmit

Example

Example 1

; Get a reference to a specific form by 0-based index,
; in this case the first form on the page

#include <IE.au3>

Local $oIE = _IECreate("http://www.google.com")
Local $oForm = _IEFormGetCollection($oIE, 0)
Local $oQuery = _IEFormElementGetCollection($oForm, 4)
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

Example 2

; Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("http://www.autoitscript.com")
Local $oForms = _IEFormGetCollection($oIE)
MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & @extended & " form(s) on this page")
For $oForm In $oForms
        MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name)
Next

Example 3

; Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each
; demonstrating use of form index

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("http://www.autoitscript.com")
Local $oForms = _IEFormGetCollection($oIE)
Local $iNumForms = @extended
MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & $iNumForms & " forms on this page")
Local $oForm
For $i = 0 To $iNumForms - 1
        $oForm = _IEFormGetCollection($oIE, $i)
        MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name)
Next