Jump to content

Recommended Posts

Posted

I am trying to understand the methods that return "collections", but the only one I can get to work is

_IELinkGetCollection. All of the others only give me a few garbage characters, and that's it! I have searched the forums, and have yet to find a faq or example that explains how to use them. Can someone please help?

  • Moderators
Posted

I am trying to understand the methods that return "collections", but the only one I can get to work is

_IELinkGetCollection. All of the others only give me a few garbage characters, and that's it! I have searched the forums, and have yet to find a faq or example that explains how to use them. Can someone please help?

Hopefully this will give you an idea.

#include <IE.au3>

$oIE = _IECreate("www.google.com")
; Get a collection variable of all links
$oLinks = _IELinkGetCollection($oIE)
MsgBox(0, "", "Total Links: " & @extended, 2)
$i = 1
; Loop through all links
For $oLink In $oLinks
    ; Store the current link text
    $sText = $oLink.outerText
    ; Store the current link url
    $sURL = $oLink.href
    MsgBox(0, "Link " & $i, "Text: " & $sText & @CRLF & "URL: " & $sURL, 2)
    $i += 1
Next

_IEQuit($oIE)
Posted

Thanks for the reply.

Funny, you used the one function that I can get to work. Whenever I try the other collection functions, I just get garbage returned. If it's not too much trouble, can you do the same with _ImgGetCollection?

Like, this, for example. It just returns some garbage characters. Why?

#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oImgs = _IEImgGetCollection ($oIE)
For $oImg In $oImgs
    MsgBox(0, "Link Info", $oImg)
Next
  • Moderators
Posted

This is a slightly modified version from the help file, which I strongly suggest you take a look at.

#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreate("http://www.autoitscript.com")

$oImgs = _IEImgGetCollection($oIE)
MsgBox(0, "", "Total Imgs " & @extended, 2)
$i = 1
For $oImg In $oImgs
    $sInfo = "Src: " & $oImg.src & @CR
    $sInfo &= "FileName: " & $oImg.nameProp & @CR
    $sInfo &= "Height: " & $oImg.height & @CR
    $sInfo &= "Width: " & $oImg.width & @CR
    $sInfo &= "Border: " & $oImg.border
    MsgBox(0, "Img " & $i, $sInfo, 3)
    $i += 1
Next
Posted

This is a slightly modified version from the help file, which I strongly suggest you take a look at.

Ah-ha. I totally understand now. I think I was concentrating too much on the "collection" part and not the "object" part. As for your suggestion, I have installed AutoIt on all of my machines, with a shortcut to this help file and the _IE helpfile. :whistle:

Many thanks, I greatly appreciate it.

Posted

Ok, I do understand, but where are the object properties for a given object listed?

Let's not use the _IEImgGetCollection since the help file gives you the object methods.

For instance, on _IETableGetCollection, are there no dot commands you can use with it? The only informtion you get from this object is the number of tables in @extended? Like, in the _Img object, you had $oImg.nameProp, $oImg.height, etc. You must have gotten those object methods from the help file, I guess.

But for _IETableGetCollection, there's no object methods listed at all, just the number of tables in @extended.

Are there any additional methods for the _IETableGetCollection object, and if so, how do I find out what they are? They aren't listed in the help file like they are for _IEImgGetCollection. Please advise.

  • Moderators
Posted

Here is the link I use to get that kind of information. HTML & DHTML Reference

From the link above you can check out "DHTML Properties" for all the different properties available. Then if you open one of the property pages, at the bottom of the page it will tell you what objects it applies to.

Posted (edited)

** Edit: reply collision... The link I provided is the DHTML Objects link from the page that big_daddy gives you...

Best place to look is in MSDN. If you execcute _IE_Introduction() you'll get a browser window with some pointers in it.

Here is a list of DHTML objects that will then link you to lists of their properties and other attributes.

Dale

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...