Function Reference


Returns an object variable by name

#include <IE.au3>
_IEGetObjByName ( ByRef $oObject, $sName [, $iIndex = 0] )


$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$sName Specifies name of the object you wish to match
$iIndex [optional] If name occurs more than once, specifies instance by 0-based index
    0 (Default) or positive integer returns an indexed instance
    -1 returns a collection of the specified objects

Return Value

Success: an object variable pointing to the specified Object, @extended = specified object count.
Failure: sets the @error flag to non-zero.
@error: 3 ($_IEStatus_InvalidDataType) - Invalid Data Type
7 ($_IEStatus_NoMatch) - No Match
@extended: Contains invalid parameter number


This function will return an object reference to any object in the document with a specified name or id.
DOM elements can have Name or ID attributes or both.
A specific ID can be assigned to only a single element while a specific Name can be assigned to multiple elements.
In Internet Explorer, the Name and ID namespaces are shared.




; Open a browser to the form example, get an object reference
; to the element with the name "ExampleForm".  In this case the
; result is identical to using $oForm = _IEFormGetObjByName($oIE, "ExampleForm")

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

Local $oIE = _IE_Example("form")
Local $oForm = _IEGetObjByName($oIE, "ExampleForm")
MsgBox($MB_SYSTEMMODAL, "ExampleForm", _IEPropertyGet($oForm, "innertext") & @CRLF)