Function Reference


_IEImgGetCollection

Returns a collection object variable representing the IMG tags in the document or a single image by index

#include <IE.au3>
_IEImgGetCollection ( 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 IMG tags in the document, @extended = img 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

_IEFormImageClick, _IEImgClick

Example

Example 1

; Create browser at AutoIt homepage, get a reference to the 5th Image
; on the page (note: the first image is index 0)
; and display information about it

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

Local $oIE = _IECreate("http://www.autoitscript.com/")
Local $oImg = _IEImgGetCollection($oIE, 4)
Local $sInfo = "Src: " & $oImg.src & @CRLF
$sInfo &= "FileName: " & $oImg.nameProp & @CRLF
$sInfo &= "Height: " & $oImg.height & @CRLF
$sInfo &= "Width: " & $oImg.width & @CRLF
$sInfo &= "Border: " & $oImg.border
MsgBox($MB_SYSTEMMODAL, "5th Image Info", $sInfo)

_IEQuit($oIE)

Example 2

; Create browser at AutoIt homepage, get Img collection
; and display src URL for each

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

Local $oIE = _IECreate("http://www.autoitscript.com/")
Local $oImgs = _IEImgGetCollection($oIE)
Local $iNumImg = @extended

Local $sTxt = "There are " & $iNumImg & " images on the page" & @CRLF & @CRLF
For $oImg In $oImgs
    $sTxt &= $oImg.src & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Img Info", $sTxt)

_IEQuit($oIE)