Sign in to follow this  
Followers 0
Orangey

noob help with _IEImgClick

5 posts in this topic

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.jpg

Thanks

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

Thanks, that's just what I needed :whistle:

Share this post


Link to post
Share on other sites

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

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