Jump to content
Sign in to follow this  

Links outside Tables

Recommended Posts

I have no problem retrieving links from a web page but only want the ones within a Table. In using the _IELinkGetCollection I retrieve them all. Could someone assist by an additional statement within this command or is their a way via the _IETagnameGetCollection or similar.

Thanks you.

Share this post

Link to post
Share on other sites


The following example reads a downloaded HTML source file and outputs links within tables.

Note - I'm just learning how to work with HTML objects so I'm sure that there are other/better way to do this, but this works for me.

#include <IE.au3>
#include <array.au3>


ConsoleWrite(@error & @LF)

Func _lnks($html_code)

    Local $o_htmlfile = ObjCreate('HTMLFILE')

    If Not IsObj($o_htmlfile) Then Return SetError(-1, 0, '')


    Local $otbls = _IETagnameGetCollection($o_htmlfile, 'TABLE')

    if not isobj($otbls) then return seterror(-2)

    for $otbl in $otbls
        local $olnks = _ietagnamegetcollection($otbl, 'A')
        if not isobj($olnks) then return seterror(-3)
        ConsoleWrite('Links for table = ' & $otbl.id & ' ' & $otbl.title & ' ' & $otbl.summary & @LF)
        for $olnk in $olnks
            ConsoleWrite(@tab & $olnk.href & @LF)



Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...