Tom
Mon Oct 16 15:42:19 CDT 2006
In short, there is no 'print' object available to script.
However, if your default printer is attached to the LPT1 (or another
local port) you may be able to send simple, unformatted output to the
printer by opening that port and writing to it. For example, ...
with createobject("scripting.filesystemobject")
set printer = .opentextfile("LPT1",2)
For i = 0 To 1000 Step 100
Printer.WriteLine i
Next
end with
Newer printers may not support this and the output will be ugly.
Another common is to write the data to a temporary file and then use
notepad to send the data to the printer, as in ...
const wait = true
hideWindow = 0
tempName = "tempfile.txt"
with createobject("scripting.filesystemobject")
set tempfile = .opentextfile(tempName,2)
For i = 0 To 1000 Step 100
tempfile.WriteLine i
Next
tempfile.close
createobject(wscript.shell").run "notepad /p " &
"tempfile.txt",hideWindow ,Wait
tempfile. delete
end with
There are other techniques documented - try a google.groups search of
this group or better yet "microsoft.public.scripting.*".
Tom Lavedas
=============
http://members.cox.net/tglbatch/wsh
PC wrote:
> how can i print to the default printer in vbscript
> example (in vb6):
> For i = 0 To 1000 Step 100
> Printer.Line (i, 0)-(i, 1000)
> Next