Login | |
|
 |
RE: An easy VBS just to save a web-page to MHT... - 10/24/2007 9:48:24 PM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Heh, I saw this over at Experts Exchange as well. If you have a script ath will email the page after creating/getting it, post that code, and we can help you trim it down to just save the file rather than emailing it. Be aware, however, that while you most likely have benign intentions, some AV software view any vbs that works with web pages as a virus/trojan. Had a huge script deleted out from underneath of me one time because Norton decided it was a trojan. Grrrr.
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
 |
RE: An easy VBS just to save a web-page to MHT... - 10/24/2007 10:40:03 PM
|
|
 |
|
| |
asgarcymed
Posts: 14
Score: 0
Joined: 10/24/2007
Status: offline
|
All examples seems to be totally wrong (I tried copy-paste and always got errors). Here is one: Set cdo_message_object = CreateObject("CDO.Message") Set stream_ado_object = CreateObject("ADODB.Stream") cdo_message_object.CreateMHTMLBody "http://en.wikipedia.org/wiki/Array", 0, "","" stream_ado_object.GetStream stream_ado_object.SaveToFile "C:\array.mht" The line cdo_message_object.CreateMHTMLBody (...) always gives error!!! I tried: cdo_message_object.CreateMHTMLBody "http://en.wikipedia.org/wiki/Array", 0, "","" cdo_message_object.CreateMHTMLBody (http://en.wikipedia.org/wiki/Array, 0, "","") cdo_message_object.CreateMHTMLBody ("http://en.wikipedia.org/wiki/Array", 0, "","") None worked :(
|
|
| |
|
|
|
 |
RE: An easy VBS just to save a web-page to MHT... - 10/25/2007 3:01:46 AM
|
|
 |
|
| |
asgarcymed
Posts: 14
Score: 0
Joined: 10/24/2007
Status: offline
|
What a great mystery!!!!! Take a look at this VBS: quote:
'MakeMHT.vbs Const adSaveCreateNotExist = 1 Const adSaveCreateOverWrite = 2 Const adTypeBinary = 1 'Binary data Const adTypeText = 2 '(Default) Text data URL = "http://www.paulsadowski.com/" DiskFile = "C:\test.mht" Set objMessage = CreateObject("CDO.Message") objMessage.CreateMHTMLBody URL SaveToFile objMessage, DiskFile Sub SaveToFile(Msg, Fn) Dim Strm, Dsk Set Strm = CreateObject("ADODB.Stream") Strm.Type = adTypeText Strm.Charset = "US-ASCII" Strm.Open Set Dsk = Msg.DataSource Dsk.SaveToObject Strm, "_Stream" Strm.SaveToFile Fn, adSaveCreateOverWrite End Sub This works fine. Now look at this one (everything is the same, except the URL itself): quote:
'MakeMHT.vbs Const adSaveCreateNotExist = 1 Const adSaveCreateOverWrite = 2 Const adTypeBinary = 1 'Binary data Const adTypeText = 2 '(Default) Text data URL = "http://www.yahoo.com/" DiskFile = "C:\test.mht" Set objMessage = CreateObject("CDO.Message") objMessage.CreateMHTMLBody URL SaveToFile objMessage, DiskFile Sub SaveToFile(Msg, Fn) Dim Strm, Dsk Set Strm = CreateObject("ADODB.Stream") Strm.Type = adTypeText Strm.Charset = "US-ASCII" Strm.Open Set Dsk = Msg.DataSource Dsk.SaveToObject Strm, "_Stream" Strm.SaveToFile Fn, adSaveCreateOverWrite End Sub Why the hell this second scripts causes an error - «(12,1) CDO.Message.1: Invalid syntax»?????????? Everything is exactly the same except: URL = "http://www.paulsadowski.com/" => => URL = "http://www.yahoo.com/"
|
|
| |
|
|
|
 |
RE: An easy VBS just to save a web-page to MHT... - 10/25/2007 3:34:28 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Well, I'm not a web dude so I doubt I will have the best answers. quote:
How many different encoding types exists? Not sure, but I think the technical term is "buttload". Look here: http://www.iana.org/assignments/character-sets quote:
How can I preview such different encoding? Again I am not sure, but you may want to lookup the properties and methods of the Message object to see what encodings it is limited to.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|