Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IExplorer Save as

Status
Not open for further replies.

canberrasnag

Programmer
Nov 25, 2004
19
RU
blnSuccess = IEObject.document.ExecCommand("SaveAS",false, "c:\testing\mine\table2.html")

execCommand Method

From everyting I read onthe net, this should work when all my security setting are set to minimum...
The saveAs dialog should automatically default to "Save".
But it doesn't.
Any ideas?
this is being run from a .vbs file
 
Hello canberrasng,

Second parameter won't deliver for "SaveAs" as least.

In the approach you're adapting, for simple html page, you can do it like this.
Code:
savefile="c:\testing\mine\table2.html"
surl="\\server\share\table2.html"    'any valid surl

set oie=createobject("internetexplorer.application")
oie.navigate surl
do while not oie.readystate<>4 : wscript.sleep : loop
s=oie.document.documentElement.outerHTML

set fso=createobject("scripting.filesystemobject")
set ofile=fso.createtextfile(savefile,true)
ofile.write s
ofile.close
set ofile=nothing

oie.visible=true
'wscript.echo "to quit"
'oie.quit
set oie=nothing
The info (such as textfile line break) irrelevant to html rendering is lost, with no regret though. As to the generic shortcomings, I let you to figure out.

Another approach with ie automation is to use msxmlhttp component. But that is another story. The above approach, if used judiciously and in appropriate situation, is perfectly valid.

regards - tsuji
 
Amendment:

Just to correct a slip:
[tt] do while [red]not[/red] oie.readystate<>4 : wscript.sleep[COLOR=red yellow] [/color]: loop
[/tt]should be read:
[tt] do while oie.readystate<>4 : wscript.sleep 50 : loop[/tt]
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top