set IE = CreateObject("InternetExplorer.Application")
IE.visible = false
IE.silent = true
IE.navigate "file://x:/ie.htm", 12
wscript.echo "Len = " & IE.document.all.length
for each element in IE.document.all
wscript.echo element.tagName
next
IE.ExecWB 71, 0, "x:\\ie2.htm", ""
The error I get (on the last line) is:
X:\ie.vbs: Trying to revoke a drop target that has not been registered
Any ideas?
-Jeff
Michael Harris wrote in message ...
SendKeys "c:\temp\test.html" & vbCrLf
IE.ExecWB ....
Works fine for me...
Greetings,
Ted
In article <erzA04qd$GA.270@cppssbbsa05>,
"Michael Harris" <Please...@To.NewsGroup> wrote:
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_104C_01BF766A.F24E6C60
> Content-Type: text/plain;
> charset="Windows-1252"
> Content-Transfer-Encoding: quoted-printable
>
> It hangs because there's a SaveAs dialog box waiting. You can't see
it =
> because you're running IE invisible.
>
> I got a little farther with this:
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> html =3D "<HTML><HEAD><TITLE>This is the
title</TITLE></HEAD><BODY>This =
> is the body.</BODY></HTML>"
>
> set IE =3D CreateObject("InternetExplorer.Application")
> IE.visible =3D true
>
> IE.navigate "about:" & html=20
> while ie.busy:wend
>
> wscript.echo "Len =3D " & IE.document.all.length
>
> for each element in IE.document.all
> wscript.echo element.tagName
> next
>
> Const OLECMDID_SAVEAS =3D 4
> Const OLECMDEXECOPT_DONTPROMPTUSER =3D 2
>
> IE.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER , "c:\ie2.htm"
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> What's weird is that OLECMDEXECOPT_DONTPROMPTUSER doesn't keep you
from =
> being prompted but at least the passed file name is accepted. But the
=
> language (in the SaveAs box) defaults to UNICODE. That's OK for =
> reopening in IE but is screwy if you open it in a non-UNICODE aware
text =
> editor. And if you use OLECMDEXECOPT_DODEFAULT (value 0) then the
file =
> name defaults to the page title, not what you pass.
>
> The moral of all this is: you may want to resort to getting the
contents =
> as text and saving it yourself.
>
> strHTML =3D IE.document.body.parentElement.outerHTML
> msgbox strHTML
>
> Works ok for non-frames pages...
>
> There have been several other threads over the last year about
problems =
> using ExecWB (all with printing I think) and none were successful (at
=
> least they never came back and said they finally got it to work ;-)...
>
> --=20
> Michael Harris
> MVP - Windows Script
>
> "Jeff Fink" <jfink...@yahoo.com> wrote in message =
> news:OJykPKqd$GA.62@cppssbbsa04...
> I grabbed it from some header file somewhere. Not too surprising I =
> picked the wrong one since the docs aren't very good.
> =20
> I put 4 in there, but IE never seems to save the file. It just
blocks. =
> My HTML file looks like this:
> =20
> <HTML>
> <HEAD>
> <TITLE>This is the title</TITLE>
> </HEAD>
> =20
> <BODY>
> This is the body.
> </BODY>
> </HTML>
> =20
> Both IE4.01 and IE5 get to the last line in the script and pause. And
=
> pause. And pause. The new file doesn't even get created. I'd be =
> curious to know if the script works for anybody else.
> Michael Harris wrote in message ...
> Where did you get the value 71? =20
> =20
> Try:
> =20
> Const OLECMDID_SAVEAS =3D 4
>
> --=20
> Michael Harris
> MVP - Windows Script
>
> =20
> "Jeff Fink" <jfink...@yahoo.com> wrote in message =
> news:e4Xt8Dld$GA.279@cppssbbsa04...
>
> I've got the script working to load a file and dump out the tags,
but =
> I want
> to be able to save it to another file. How do I do this? Here's my
=
> script:
>
> set IE =3D CreateObject("InternetExplorer.Application")
> IE.visible =3D false
> IE.silent =3D true
>
> IE.navigate "file://x:/ie.htm", 12
>
> wscript.echo "Len =3D " & IE.document.all.length
>
> for each element in IE.document.all
> wscript.echo element.tagName
> next
>
> IE.ExecWB 71, 0, "x:\\ie2.htm", ""
>
> The error I get (on the last line) is:
> X:\ie.vbs: Trying to revoke a drop target that has not been
registered
>
> Any ideas?
> -Jeff
>
> ------=_NextPart_000_104C_01BF766A.F24E6C60
> Content-Type: text/html;
> charset="Windows-1252"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content=3D"text/html; charset=3Dwindows-1252" =
> http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
=
> Transitional//EN">
> <META content=3D"MSHTML 5.00.3013.2600" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT size=3D2>It hangs because there's a SaveAs dialog box =
> waiting. =20
> You can't see it because you're running IE invisible.</FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>I got a little farther with this:</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT =
>
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<=
> /FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2>html =3D
"<HTML><HEAD><TITLE>This =
> is the=20
> title</TITLE></HEAD><BODY>This is the=20
> body.</BODY></HTML>"</FONT></DIV>
> <DIV><FONT size=3D2><BR>set IE =3D=20
> CreateObject("InternetExplorer.Application")<BR>IE.visible =3D=20
> true<BR></DIV></FONT>
> <DIV><FONT size=3D2>IE.navigate "about:" & html <BR>while=20
> ie.busy:wend</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2>wscript.echo "Len =3D " &=20
> IE.document.all.length</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2>for each element in =
> IE.document.all<BR> =20
> wscript.echo element.tagName<BR>next</FONT></DIV>
> <DIV><FONT size=3D2><BR>Const OLECMDID_SAVEAS =3D 4<BR>Const=20
> OLECMDEXECOPT_DONTPROMPTUSER =3D 2</FONT></DIV>
> <DIV><FONT size=3D2><BR>IE.ExecWB OLECMDID_SAVEAS, =
> OLECMDEXECOPT_DONTPROMPTUSER ,=20
> "c:\ie2.htm"</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT =
>
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=
> </FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2>What's weird is that OLECMDEXECOPT_DONTPROMPTUSER
=
> doesn't keep=20
> you from being prompted but at least the passed file name is =
> accepted. But=20
> the language (in the SaveAs box) defaults to UNICODE.
That's =
> OK for=20
> reopening in IE but is screwy if you open it in a non-UNICODE =
> aware text=20
> editor. And if you use OLECMDEXECOPT_DODEFAULT (value 0) then
the =
> file=20
> name defaults to the page title, not what you pass.</FONT></DIV>
> <DIV><FONT size=3D2><BR>The moral of all this is: you may want to
resort =
> to=20
> getting the contents as text and saving it yourself.</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2>strHTML =3D =
> IE.document.body.parentElement.outerHTML<BR>msgbox=20
> strHTML</FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>Works ok for non-frames pages...<BR></DIV></FONT>
> <DIV><FONT size=3D2>There have been several other threads over the
last =
> year about=20
> problems using ExecWB (all with printing I think) and none were =
> successful (at=20
> least they never came back and said they finally got it to work=20
> ;-)...</DIV></FONT>
> <DIV><BR>-- <BR>Michael Harris<BR>MVP - Windows Script</DIV>
> <DIV> </DIV>
> <DIV> </DIV>
> <DIV>"Jeff Fink" <<A=20
> href=3D"mailto:jfink...@yahoo.com">jfink...@yahoo.com</A>>
wrote =
> in message=20
> <A=20
>
href=3D"news:OJykPKqd$GA.62@cppssbbsa04">news:OJykPKqd$GA.62@cppssbbsa04
<=
> /A>...</DIV>
> <DIV><FONT color=3D#000000 size=3D2>I grabbed it from some header
file=20
> somewhere. Not too surprising I picked the wrong one since the =
> docs aren't=20
> very good.</FONT></DIV>
> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>I put 4 in there, but IE never seems to save the =
> file. =20
> It just blocks. My HTML file looks like this:</FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT
size=3D2><HTML><BR><HEAD><BR> =20
> <TITLE>This is the =
> title</TITLE><BR></HEAD></FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2><BODY><BR> This is the=20
> body.<BR></BODY><BR></HTML</FONT><FONT =
> size=3D2>></FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>Both IE4.01 and IE5 get to the last line in the =
> script and=20
> pause. And pause. And pause. The new file doesn't
even =
> get=20
> created. I'd be curious to know if the script works for
anybody=20
> else.</FONT></DIV>
> <BLOCKQUOTE=20
> style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px;
PADDING-LEFT: =
> 5px">
> <DIV>Michael Harris<PLEASE...@TO.NEWSGROUP> wrote in=20
> message<ECW#QIOD$GA.201@CPPSSBBSA05> ...</DIV>
> <DIV><FONT size=3D2>Where did you get the value 71? =
> </FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>Try:</FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>Const OLECMDID_SAVEAS =3D 4</FONT></DIV>
> <DIV><FONT size=3D2><BR>-- <BR>Michael Harris<BR>MVP - Windows=20
> Script</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV>"Jeff Fink" <<A=20
> href=3D"mailto:jfink...@yahoo.com">jfink...@yahoo.com</A>> =
> wrote in=20
> message <A=20
> =
>
href=3D"news:e4Xt8Dld$GA.279@cppssbbsa04">news:e4Xt8Dld$GA.279@cppssbbsa
0=
> 4</A>...</DIV><BR>I've=20
> got the script working to load a file and dump out the tags, but I =
> want<BR>to=20
> be able to save it to another file. How do I do this? =
> Here's my=20
> script:<BR><BR>set IE =3D=20
> CreateObject("InternetExplorer.Application")<BR>IE.visible =3D=20
> false<BR>IE.silent =3D true<BR><BR>IE.navigate "<A=20
> href=3D'file://x:/ie.htm"'>file://x:/ie.htm"</A>, =
> 12<BR><BR>wscript.echo "Len =3D=20
> " & IE.document.all.length<BR><BR>for each element in=20
> IE.document.all<BR> wscript.echo=20
> element.tagName<BR>next<BR><BR>IE.ExecWB 71, 0, "x:\\ie2.htm",=20
> ""<BR><BR><BR>The error I get (on the last line) is:<BR>X:\ie.vbs: =
> Trying to=20
> revoke a drop target that has not been registered<BR><BR>Any=20
> ideas?<BR>-Jeff<BR><BR></BLOCKQUOTE></BODY></HTML>
>
> ------=_NextPart_000_104C_01BF766A.F24E6C60--
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.