Link to home
Start Free TrialLog in
Avatar of sjeffress
sjeffress

asked on

Automation of IE6

Hi,

I would like some help with automating IE6.

In particular I wish to
1 - load a web page
2 - search the contents of the page to see if there are any pictures
3 - for pictures, determine the picture type, physical dimensions, size and any link that it may contain
4 - save the picture to the hard drive

Can someone please help

Thanks,
 Steve
Avatar of sjeffress
sjeffress

ASKER

Oh, sorry.  I forgot an important point.  I am using VBA (access).
The below is in VB but can be adapted to VBA. It doesn't include options for saving the images (or obtaining physical dimensions) as there are 2 methods you can use:

1.) Enumerate IE cache for the image, copy it from there, load the image into an StdPicture object and retrieve the dimensions.

2.) Download the file yourself (perhaps with URLDownloadToFile() API) and repeat the StdPicture method from #1 to retrieve dimensions.


Form1:
---------------------------
'Project -> References... -> Microsoft HTML Object Library
Option Explicit
Private Sub Command1_Click()
    Dim hDoc1 As HTMLDocument
    Dim hDoc2 As HTMLDocument
    '1 - load a web page
    Set hDoc1 = New HTMLDocument
    Set hDoc2 = hDoc1.createDocumentFromUrl("http://www.yahoo.com", vbNullString)
    Do Until (hDoc2.readyState = "complete")
        DoEvents
    Loop
    '2 - search the contents of the page to see if there are any pictures
    If Not (hDoc2 Is Nothing) Then
        Dim hImg As HTMLImg
        For Each hImg In hDoc2.images
            '3 - for pictures, determine the picture type, physical
            '    dimensions, size and any link that it may contain
            Debug.Print hImg.mimeType   'type
            Debug.Print hImg.src              'source
            Debug.Print hImg.fileSize        'size
            Debug.Print vbNullString
        Next
    End If
End Sub
Is there any way that internet explorer can display the page being accessed at the time?

Also, is there any way that i can get the link that sits behind the image.  eg. if you clicked on a picture and it went to www.google.com, how do i pick up that link?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of zzzzzooc
zzzzzooc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial