Function Reference


_IEImgClick

Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src

#include <IE.au3>
_IEImgClick ( ByRef $oObject, $sLinkText [, $sMode = "src" [, $iIndex = 0 [, $iWait = 1]]] )

Parameters

$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$sLinkText Text to match the content of the attribute specified in $sMode
$sMode [optional] specifies search mode
    "src" = (Default) match the url of the image
    "id" = match the id of the image (see remarks)
    "alt" = match the alternate text of the image
$iIndex [optional] If the img text occurs more than once, specify which instance you want by 0-based index
$iWait [optional] specifies whether to wait for page to load before returning
    0 = Return immediately, not waiting for page to load
    1 = (Default) Wait for page load to complete before returning

Return Value

Success: None.
Failure: 0 or -1 and sets the @error flag to non-zero.
@error: 1 ($_IEStatus_GeneralError) - General Error
2 ($_IEStatus_COMError) - COM Error in Object reference
3 ($_IEStatus_InvalidDataType) - Invalid Data Type
4 ($_IEStatus_InvalidObjectType) - Invalid Object Type
5 ($_IEStatus_InvalidValue) - Invalid Value
6 ($_IEStatus_LoadWaitTimeout) - Load Wait Timeout
7 ($_IEStatus_NoMatch) - No Match
8 ($_IEStatus_AccessIsDenied) - Access Is Denied
9 ($_IEStatus_ClientDisconnected) - Client Disconnected
@extended: Contains invalid parameter number

Remarks

"name" is no more supported when using HTLM5 but still accepted and equivalent to "id" for HTML5 pages.

Related

_IEFormImageClick, _IEImgGetCollection, _IELoadWait

Example

Example 1

; Click on IMG by Alt text

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEImgClick($oIE, "AutoIt Homepage Image", "alt")

Example 2

; Click on IMG by id

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEImgClick($oIE, "AutoItImage", "id") ; "name" is still equivalent for HTML5 pages

Example 3

; Click on IMG by src sub-string

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEImgClick($oIE, "autoit_6_240x100.jpg", "src")

Example 4

; Click on IMG by full src string

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IEImgClick($oIE, "http://www.autoitscript.com/images/logo_autoit_210x72.png")