This How To is about creating a Virtual Printer on an MCP system to transfer files to a remote Windows NT system, where the files are processed by a VBScript.
On the MCP system CopyWrite implements a Print System Virtual Server. It is a procedure which is exported from the SL COPYWRITE codefile and is called REMOTEPRINTSERVER.
The Print System PS CONFIG command is used to associate a Printer Name with the Virtual Server, thereby creating a Virtual Printer.
When the Print System receives a Print Request for the Printer Name, it calls the CopyWrite Virtual Server with the name of each file which is to be printed.
When the names of all the files in the Print Request have been received, the Virtual Server makes a connection to the remote Windows host which is running the CopyWrite AutoPrint Service, and passes it the names of the files and other information provided by the Print System in the Info array.
The Virtual Server then copies the files into either a CD Image or a Wrapped Container at the remote host, and when the copy is completed, it informs the CopyWrite AutoPrint Service of the title of the file.
The CopyWrite AutoPrint Service then invokes the VBScript , which was specified when the Virtual Server was configured, to process the CD Image or Wrapped Container.
The Script can do things with the Image itself, or with the files in the Image. It is provided with a Selector Object for accessing the Files and Disk File Headers, a Script Object which provides the Title of the Image and other information about the session and an Info Object which provides access to the information in the Print System Info Array.
The Virtual Server is configured using the PS CONFIG command.
PS CONFIG PRINTNT SERVER = "REMOTEPRINTSERVER(
DESTINATION='SITE',
SCRIPT=PRINT,
TYPE=CD,
HOSTNAME=CPNTA,
PATH=*ASERIESPRINT ON C) IN SL COPYWRITE
The Printer Name is PRINTNT.
The DESTINATION is any name and it is provided to the Script.
The SCRIPT=PRINT specifies that the VBScript to be executed on the Windows NT system is called Print.vbs, and it must be located in the Scripts directory of the directory in which CopyWrite on NT was installed (usually C:\Program Files\Metalogic\CopyWrite).
The TYPE=CD specifies that the files are to be copied into a Library/Maintenance CD Image at the remote Windows Host. If a Wrapped Container is required, use TYPE=WRAP.
The HOSTNAME=CPNTA specifies the TCP/IP Network Hostname which is used to open a socket connection.
The PATH=*ASERIESPRINT ON C specifies that the Image or Container should be copied into the C:\ASERIESPRINT directory at the remote host.
The actual title is created as C:\ASERIESPRINT\<date>\<usercode>\<jobno>_<task_no> with an extension of .mcp for a CD Image and .con for a Wrapped Container.
The CopyWrite AutoPrint Service provides this VBScript called PRINT.
' ***** Create the Report File ***** Set FileSystem = CreateObject("Scripting.FileSystemObject") ' ***** Select the A-Series Disk Volume ***** Spout("There are " & Selector.FileCount & " Files on the Disk") Spout("Image is " & Script.ImageName) Spout("Note is " & Info.Tr_Note) ' ***** Select the Files ***** For Each File In Selector Spout(File.FileName) FileName=Script.ImagePath & "\" & File.FlatName & ".txt" Spout(FileName) If Not Selector.ConvertToText(File.FileNo,FileName,TRUE,Reason) then Spout(Reason) End If Next
This script uses the Selector Object to process each file in the Image. It creates a filename with a .txt extension and then converts the file into text, placing it into the same directory as the Image.
It uses the Spout method to send messages back to the MCP system which sent the request.
The Tr_Note property of the Info property was provided by the Print System in the Info array from the original Print Request Note attribute.