I have directories full of *.htm & *.html files, which I want to print
via MSIE (v6.0). The code that I have muddled thru currently will
open MSIE, displays the correct number of files in the directory that
I have dropped on the *.wsf, and then closes. However, it does not
print.

My code is:

<package>
<job>
<script language="vbscript">

dim fso, fldr, fldrs, fltag, mergelist,fc, nfc, x
set fso = createobject("scripting.filesystemobject")
set ie = createobject("internetexplorer.application")
set oWsh = createobject("wscript.shell")
set oArgs = wscript.arguments
fileerror = 0
on error resume next

if oArgs.count = 1 then
set fldrs = fso.getfolder(oArgs(0))
set fc = fldrs.files
ie.Visible = true

wscript.echo cstr(fc.count) + " files found."
for each fl in fc
on error resume next

if instr(ucase(fl.name), ".HTM") > 0 or instr(ucase(fl.name), ".HTML")
> 0 then


documents.open oArgs(0) + "\" + fl.name
if documents.count > 0 then
With documents.PageSetup
End With
with documents.PrintOptions
.outputtype = 1
.printcolortype = 2
.printinbackground = false
end with
documents.PrintOut
end if
documents.close
end if
next
end if

ie.quit
set ie = nothing
wscript.echo cstr(fileerror) + " errors."

</script>
</job>
</package>

I have no clue how to proceed. I get a LOT of *.htm & *.html files
that I need to print!

I'm used to Excel's VB, but this is a different ball of wax
altogether.

Thanks for any assistance y'all can provide!

Re: Printing HTML files via *.wsf by name

name
Tue Dec 30 01:16:50 CST 2003

You are not saying whether you need to print text or markup.

There is a /p switch for e.g. notepad started via Run(...

There is a html object, that has no window but carries the dom.

There is the print method in dom of a displayed page

And there are various exec commands in dom.

--------

Your code is nice but fails where rendering of markup needs time.

So you will need to read up some posts from Mike Harris and all the cracks

of the group. Go ahead.



"Excel's VB ... different ball of wax altogether"

Definitely




"Arawn" <arawndeathlord@hotmail.com> wrote in message
news:ce588ef9.0312291248.292ebfe2@posting.google.com...
> I have directories full of *.htm & *.html files, which I want to print
> via MSIE (v6.0). The code that I have muddled thru currently will
> open MSIE, displays the correct number of files in the directory that
> I have dropped on the *.wsf, and then closes. However, it does not
> print.
>
> My code is:
>
> <package>
> <job>
> <script language="vbscript">
>
> dim fso, fldr, fldrs, fltag, mergelist,fc, nfc, x
> set fso = createobject("scripting.filesystemobject")
> set ie = createobject("internetexplorer.application")
> set oWsh = createobject("wscript.shell")
> set oArgs = wscript.arguments
> fileerror = 0
> on error resume next
>
> if oArgs.count = 1 then
> set fldrs = fso.getfolder(oArgs(0))
> set fc = fldrs.files
> ie.Visible = true
>
> wscript.echo cstr(fc.count) + " files found."
> for each fl in fc
> on error resume next
>
> if instr(ucase(fl.name), ".HTM") > 0 or instr(ucase(fl.name), ".HTML")
> > 0 then
>
>
> documents.open oArgs(0) + "\" + fl.name
> if documents.count > 0 then
> With documents.PageSetup
> End With
> with documents.PrintOptions
> .outputtype = 1
> .printcolortype = 2
> .printinbackground = false
> end with
> documents.PrintOut
> end if
> documents.close
> end if
> next
> end if
>
> ie.quit
> set ie = nothing
> wscript.echo cstr(fileerror) + " errors."
>
> </script>
> </job>
> </package>
>
> I have no clue how to proceed. I get a LOT of *.htm & *.html files
> that I need to print!
>
> I'm used to Excel's VB, but this is a different ball of wax
> altogether.
>
> Thanks for any assistance y'all can provide!


Re: Printing HTML files via *.wsf by arawndeathlord

arawndeathlord
Tue Dec 30 09:39:17 CST 2003

I want to print the *.html file exactly as it appears on MSIE, not the
HTML code.

I've been searching the posts for anything related to using MSIE to
print files, but nothing seems to exactly match what I'm attempting to
do.

Any guesses on how to make it cycle thru and print one *.html file at
a time, until the entire directory has been printed? I've succeeded
in thoroughly confusing myself. :)

~Arawn


"name" <nospam@user.com> wrote in message news:<etXyZaqzDHA.2156@TK2MSFTNGP09.phx.gbl>...
> You are not saying whether you need to print text or markup.
>
> There is a /p switch for e.g. notepad started via Run(...
>
> There is a html object, that has no window but carries the dom.
>
> There is the print method in dom of a displayed page
>
> And there are various exec commands in dom.
>
> --------
>
> Your code is nice but fails where rendering of markup needs time.
>
> So you will need to read up some posts from Mike Harris and all the cracks
>
> of the group. Go ahead.
>
>
>
> "Excel's VB ... different ball of wax altogether"
>
> Definitely