Hello, hon:
On Mon, 1 Aug 2005 03:44:42 +0800: you wrote...
h>
h> I have a job duty need to save daily stock data web page as .mht and
h> .html files (since include image).
h> I want to set a schdule task which can auto save the updated web page
h> daily, can I do that with script?
Does the machine have CDO installed?
'MakeMHT.vbs (not sure who I borrowed the sub SaveMessageToFile from)
URL = "
http://www.paulsadowski.com/WSH/xmlhttp.htm"
Set objMessage = CreateObject("CDO.Message")
objMessage.CreateMHTMLBody URL
SaveMessageToFile objMessage, "C:\temp\test.mht"
Sub SaveMessageToFile(iMsg, Filepath)
Dim Stm
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
Set Stm = CreateObject("ADODB.Stream")
Stm.Type = adTypeText ' 2
Stm.Charset = "US-ASCII"
Stm.Open
Dim iDsrc
Set iDsrc = iMsg.DataSource
iDsrc.SaveToObject Stm, "_Stream"
Stm.SaveToFile Filepath, adSaveCreateOverWrite
End Sub
For the HTML see GetHTMLSource.vbs on
http://www.paulsadowski.com/WSH/xmlhttp.htm
You'll have to modify it to save to a file rather than the STDOUT.
Regards, PaulR. Sadowski [MVP].