Daily auto save Web page

  • Thread starter Thread starter hon
  • Start date Start date
H

hon

I have a job duty need to save daily stock data web page as .mht and .html
files (since include image).
I want to set a schdule task which can auto save the updated web page daily,
can I do that with script?

Thx a lot.
 
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].
 
ExecWB Method



Executes a command on an OLE object and returns the status of the command execution using the IOleCommandTarget interface.
Syntax
object.ExecWB( _
cmdID As OLECMDID, _
cmdexecopt As OLECMDEXECOPT, _
[pvaIn As Variant,] _
[pvaOut As Variant])
Parameters
cmdID
Long that represents the identifier of the command to execute. For more information on command identifiers, see MSHTML Command Identifiers.
cmdexecopt
OLECMDEXECOPT value that specifies the command options.
pvaIn
Optional. A Variant used for specifying command input arguments.
pvaOut
Optional. A Variant used for specifying command output arguments.
Applies To
[ Object Name ]
PlatformVersion
Win32:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
InternetExplorer, WebBrowser
Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms. Internet Explorer does not expose this member on platforms that are not listed.

See Also
QueryStatusWB, IOLECMDEXECOPT



© 2001 Microsoft Corporation. All rights reserved. Terms of use.



IDM_SAVEAS Saves the current Web page to a file.
 
Back
Top