Function Reference


_IELinkGetCollection

Returns a collection object containing all links in the document or a single link by index

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

Parameters

$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 collection of all links in the document, @extended = link 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

Remarks

Not all elements that appear to be links actually are.
It is common practice to attach onClick JavaScript events to other DOM elements to simulate the behavior of links.
To activate such elements, use "click" with _IEAction().

Example

; Open browser with basic example, get link collection,
; loop through items and display the associated link URL references

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

Local $oIE = _IE_Example("basic")
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended

Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
For $oLink In $oLinks
        $sTxt &= $oLink.href & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt)