Orangey Posted November 1, 2006 Share Posted November 1, 2006 Basically I want to find a link that is associated with a particular image on a website. _IEImgClick is probably not the answer, but do any of you know how I could do this? For instance on the homepage of AutoIt, how could I find the link that is associated with this image: http://www.autoitscript.com/autoit3/files/..._wall_thumb.jpgThanks Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 2, 2006 Moderators Share Posted November 2, 2006 Something like this should work for you. #include <IE.au3> $sURL = "http://www.autoitscript.com" $oIE = _IECreate($sURL) $oImgs = _IETagNameGetCollection($oIE, "IMG") For $oImg In $oImgs If StringInStr($oImg.src, "autoit_builder_wall_thumb.jpg") Then $oParent = $oImg.parentElement If $oParent.tagName = "A" Then $sLink = $oParent.href ConsoleWrite($sLink & @CR) EndIf EndIf Next Link to comment Share on other sites More sharing options...
Orangey Posted November 4, 2006 Author Share Posted November 4, 2006 Thanks, that's just what I needed Link to comment Share on other sites More sharing options...
Orangey Posted November 4, 2006 Author Share Posted November 4, 2006 Something like this should work for you. #include <IE.au3> $sURL = "http://www.autoitscript.com" $oIE = _IECreate($sURL) $oImgs = _IETagNameGetCollection($oIE, "IMG") For $oImg In $oImgs If StringInStr($oImg.src, "autoit_builder_wall_thumb.jpg") Then $oParent = $oImg.parentElement If $oParent.tagName = "A" Then $sLink = $oParent.href ConsoleWrite($sLink & @CR) EndIf EndIf Next One other thing, if I wanted to find the link inside a hyperlink... Say I'm on the AutoIt homepage again, and I want to find the link associated with mailing list would that also be possible with the above code? Thanks Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 15, 2006 Moderators Share Posted November 15, 2006 Sorry for the late reply, but this sould accomplish what you are wanting. #include <IE.au3> $sURL = "http://www.autoitscript.com" $oIE = _IECreate($sURL) $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If String($oLink.outerText) = "mailing list" Then $sLink = $oLink.href ConsoleWrite($sLink & @CR) EndIf Next Link to comment Share on other sites More sharing options...
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