Hi,
I've made some progress but the code that you gave me doesn't work for some reason...
<just a reminder here that I'm using VB5>
I Removed Microsoft Internet Controls from Components.
Then Added Microsoft Internet Controls to References.
code...
form_load
Call GetHTML 'skips over the 'if then'.
Call GetHTML("e:\website\index.html") 'skips over the 'if then'.
Call GetHTML("Browser") 'gives an error:
runtime error 438: object doesn't support this property or method (...on the 'gethtml = line')
end code...
So I played around with the WebBrowser and finished up with:
Private Sub Form_Load()
Open "d:\browser.txt" For Input As #1
Input #1, xfer1 ' = e:\website\index.html
Input #1, xfer2 ' = blank for now
Close #1
WebBrowser1.Navigate2 (xfer1)
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Number = WebBrowser1.Document.links.length
List1.AddItem "links = " & Number
List1.AddItem " "
For n = 0 To Number - 1
List1.AddItem WebBrowser1.Document.links

.href
Next n
images = WebBrowser1.Document.images.length
List1.AddItem " "
List1.AddItem "images = " & images
List1.AddItem " "
For n = 0 To images - 1
List1.AddItem WebBrowser1.Document.images

.href
Next n
List1.AddItem " "
List1.AddItem "pdisp = " & pDisp
List1.AddItem " "
List1.AddItem "url = " & URL
End Sub
' first attempt that didn't work...
'Private Sub Form_Load()
'Call GetHTML("Browser")
'Call GetHTML("e:\website\images.html")
'end sub
'Private Function GetHTML(strBrowserCaption As String) As String
' Dim ExplorerWindows As ShellWindows
' Dim BrowserWindow As WebBrowser
' Set ExplorerWindows = New ShellWindows
' For Each BrowserWindow In ExplorerWindows
' If BrowserWindow.LocationName = strBrowserCaption Then
' GetHTML = BrowserWindow.Document.body.parentNode.outerhtml
' End If
' Next
'End Function
end code....
This loads the selected page and lists the links and images.
I have to load the URL from a file as I can't use the IDE at work so I have to compile an .exe at home and run it at work...and I need to be able to select different URL's while testing.
I didn't know last night how to get into the text but looking around the internet this morning I found the .innertext .outertext commands so I'll try these over the weekend.
I can't find a list of any Webbrowser1.Document. commands... any ideas where I might get one. If I know all of the possible extensions after 'document.' then I can play around until I get something usable.
Regards
Peter