Function Reference


Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page or a single Frame or iFrame by index

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


$oObject Object variable of an InternetExplorer.Application, Window or Frame 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 containing the Frames collection, @extended = Frame 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


Although MSDN documents the return value for this function as a collection object, it cannot be looped through with a For...In...Next loop like a standard collection object.
You must instead step through the collection by index - see example.


_IEFrameGetObjByName, _IEIsFrameSet


; Open frameset example, get collection of frames
; and loop through them displaying their source URL's

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

Local $oIE = _IE_Example("frameset")
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)