Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating "Print to file" - Possible????

Status
Not open for further replies.

JAFrank

Technical User
Nov 16, 2002
84
US
I am doing some work on an old DOS app which runs acceptably well in a Win2k console window. Unfortunately, it is hard coded to print it's reports to a dot matrix printer on LPT1.

The ouput from this app has to be entered into another program, and currently someone has to retype the data from the hard copy. If I were to set up a 'Generic/Text Only' printer with 'Print to File' as my port, is there a way to pre-define the name of the file that the printer will print to? In other words, I don't want the end user to have to type in a file name when printing the file. I have written a VB program that reformats the print file for import into the database, and life would be much easier for me if the output file always had the same name and was found in the same location.

I guess what I'm asking is, is there a way to have Print to File print to the same path every time - without prompting the user?

thanks,

Allen
 
Allen,

This is quite easy.

Go to Start -> settings -> printers.
Double click Add new printer
Choose Local Printer (untick Automatically detect Plug and Play printers). Click Next
Choose "Create a new port" of type local port. Click Next. In the port name box type the path and filename to output your file to, eg C:\OUTPUT.TXT. Click OK
Choose the Generic/Text only printer driver. click Next.
Let it keep the Generic/text only driver.
Give it a unique name (so you have one set up to prompt for filename, and another with a fixed filename)
Choose "Do not share this printer" and follow the wizard through to completion.

This will show up as Generic/Text Only (Copy 2) on port C:\OUTPUT.TXT.
Anything printed to this printer will be saved to that file.

You can then modify your VB app to take input from this file.

John




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top