:confused: I have a challenge. I want to print some text based data on the client client side based on some input. I am to associate the client printer as a dos device ie LPT2 using window script host technologies but cannot just make it work. What am I doing wrong? Pls help! below is the example of what I want to do. If this can work I can implement for required scenarios.:confused: :confused: :confused:
<script language="VBScript">
sub doInitialise()
dim objPrinter, objFS, objWSHNet
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")
// ' Connect to Network Printer from Windows Script Host
objWSHNet.AddPrinterConnection "LPT2", "\\TESTBENCH\TicketPr"
// ' Open Print device as a file using the File System Object
Set objPrinter = objFS.CreateTextFile("LPT2:", True)
// ' Send text to print device using the File System Object
// '
objPrinter.Write("This is a test print to the ticket printer.")
objWSHNet.RemovePrinterConnection "LPT2:"
set objWSHNet = nothing
end sub