
How can I save a web page to file using VBS
fWrite "c:\temp\yahoo.txt", WebText("http://www.yahoo.com")
fWrite "c:\temp\yahoo.html", WebHTML("http://www.yahoo.com")
Function WebText(sUrl)
Set IE = createobject("InternetExplorer.Application")
IE.Navigate sUrl
Do Until IE.ReadyState = 4:WScript.Sleep 10 : Loop
WebText = IE.Document.Body.InnerText
IE.Quit
End Function
Function WebHTML(sUrl)
Set IE = createobject("InternetExplorer.Application")
IE.Navigate sUrl
Do Until IE.ReadyState = 4:WScript.Sleep 10 : Loop
WebHTML = IE.Document.Body.InnerHTML
IE.Quit
End Function
Sub fWrite(FilePath, sData)
'Given the path to a file, will return entire contents
With CreateObject("Scripting.FileSystemObject")._
OpenTextFile(FilePath, 2, True)
.Write sData: .Close
End With
End Sub
Quote:
> Im quite new to VBS and I was wondering how to
> programaticly have my script when it is run atuomaticly
> jump to a HyperLink and than save that web page to 2 files
> an html file and a Text file
> Please Help
> Thanx
> Dan