Sign in to follow this  
Followers 0

_IETagNameGetCollection doesn't work for IMG?

2 posts in this topic

#1 ·  Posted (edited)


I'm still learning a lot about AutoIt and IE.au3.

This is a brilliant tool that helps my everyday at work and at home.

Today I get confused by _IETagNameGetCollection and I need a little help.

I have AutoIt beta which includes IE.au3 2.0.5 (fresh install)

I tried sample code below I found in the forum and in IE_builder.au3

#include <IE.au3>

$sImgDir = "c:\"; Please make certain this folder already exists (silent failure if not)
$sWebPage = ""; webpage with images

$oIE = _IECreate()
_IENavigate($oIE, $sWebPage)
$oIMGs = _IETagNameGetCollection($oIE.document, "img")

; Loop through all IMG tags and save file to local directory using INetGet
For $oIMG in $oIMGs
    $sImgUrl = $oIMG.src
    $sImgFileName = $oIMG.nameProp
    INetGet($sImgUrl,  $sImgDir & $sImgFileName)

But I get error below returned in the SciTE console but I don't understand why.

C:\test.au3(8,54) : ERROR: _IETagNameGetCollection() called with Const or expression on ByRef-param(s).

$oIMGs = _IETagNameGetCollection($oIE.document, "img")


C:\PROGRA~1\AutoIt3\beta\Include\IE.au3(2381,73) : REF: definition of _IETagNameGetCollection().

Func _IETagNameGetCollection(ByRef $o_object, $s_TagName, $i_index = -1)


When I look at IE_Builder.au3 source, it seems to use _IETagNameGetCollection() in the same way without any problem.

Could anyone explain this to me?

FYI: I'm obviously able to get the images but using.

$oImgs = _IEImgGetCollection ($oIE)



Edited by uteotw

Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

Actually everything is working as it should, but the example is not valid with the current AutoIt IE.au3 release.

To improve resource utilization in the latest versions I changed the passing of the object variables to being byref so taht we did not create multiple copies of the variable with each function call.

$oIE.document can no longer be passed to the function because it is not a static variable.

The good news is that _IETagNameGetCollection has been enhanced so that you can simply pass in $oIE and it will convert it into a document reference for you - much simpler.

You can also replace the _IETagNameGetCollection call with _IEImgGetCollection as you pointed out (that function did not exist when I wrote that example in the forum).


Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0