copy to LPT1 via WSH 
Author Message
 copy to LPT1 via WSH

Hello All,
    having looked at the object model, I am thinking there is no way to do
this without creating an app with VB that does it, and referencing it in my
script. If anyone knows of a way to do it without writing a separate VB app
I would greatly appreciate it.

Regards,
Gordon Price



Thu, 17 May 2001 03:00:00 GMT  
 copy to LPT1 via WSH
Use the FileSystemObject and open the device LPT1 or PRN.

--
Tim Hill -- Windows NT MVP

(Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and all
nonsolicited commercial E-mail sent to this address is subject to a download
and archival fee in the amount of $1000 US.  E-mailing denotes acceptance of
these terms.)

Quote:

>Hello All,
>    having looked at the object model, I am thinking there is no way to do
>this without creating an app with VB that does it, and referencing it in my
>script. If anyone knows of a way to do it without writing a separate VB app
>I would greatly appreciate it.

>Regards,
>Gordon Price



Thu, 17 May 2001 03:00:00 GMT  
 copy to LPT1 via WSH

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.

Regards,
Gordon Price



Thu, 17 May 2001 03:00:00 GMT  
 copy to LPT1 via WSH

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/



Fri, 18 May 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. copy lpt1 w/ WSH

2. copy .ps lpt1

3. printing by copying to LPT1:?

4. Copy a Print File to LPT1:

5. Detect default printer on local LPT1 via VB script

6. How to Copy table in Access database via vbscript

7. Copying files to WinNT dir via logon script?

8. Copy an appointment to another calendar via VBscript

9. How to copy files via shell32?

10. Copying files to WinNT dir via logon script?

11. LPT1: Capture Program

12. Intercepting data to lpt1:

 

 
Powered by phpBB® Forum Software