fhanna Posted February 2, 2013 Posted February 2, 2013 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.
kylomas Posted February 2, 2013 Posted February 2, 2013 fhanna, 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> _lnks(fileread('my.file')) ConsoleWrite(@error & @LF) Func _lnks($html_code) Local $o_htmlfile = ObjCreate('HTMLFILE') If Not IsObj($o_htmlfile) Then Return SetError(-1, 0, '') $o_htmlfile.open() $o_htmlfile.write($html_code) $o_htmlfile.close() 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) next next EndFunc kylomas 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now