Quote:
> >Use the FileSystemObject and open the device LPT1 or PRN.
> Tim,
> I must be looking in the wrong place for a reference. I have tried both
> the WSH and VBScript online doco at msdn.microsoft.com\scripting, to no
> avail. Under FileSystemObject I only find two open methods, 'Open Text File'
> and 'Open as Text Stream', neither of which seems to be the one I need. If
> you would point me in the right direction, I would greatly appreciate it.
The OpenTextFile method should do the job, something like ...
Subroutine Print(Text)
Const ForReading = 1, ForWriting = 2
Dim objFS, objF
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objF = objFS.OpenTextFile("LPT1", ForWriting)
objF.WriteLine Text ' or objF.Write Text (without newline)
End Subroutine
I have noticed that the OpenTextFile will lock-up if used to open the
CON (console) device under the Wscript.exe host, but works fine under
'cscript.exe' instead. I haven't specifically tested the LPT ports to
see if they have a similar problem in Wscript.
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/