Print to File - Append to File?

G

Guest

I have set up a Print to File - Generic/Text Only printer. This is working
fine. But the program I am printing from seems to be sending every line of
print separately, that is, when printing, the window pops up and asks for a
file name for every line of print, and then saves each line of print in a
separate file. I could have 1000 lines of print, and would have to enter 1000
different file names for each file.

I am sure the actual problem is from the program I am printing out of,
because if I print a test page, or out of Word, I don't have this problem.

Is there some way to configure the print to file to append all the text to a
single file as it receives text?

I might be able to add printer codes to the end of the lines being sent from
the program I am printing from. Is there a control code I could add that
would tell the Generic/Text Only driver not to start a new file?

Or any other methods of getting all these lines of text into a single file
without having to manually enter thousands of file names first?

Any suggestions would be appreciated.
 
G

Guest

Don't know if this helps but if you use >> this command it appends in dos

i.e.
echo test > test.txt
echo test2 >> test.txt

you end up with 1 text file called test.txt with the 2 lines in it
 
D

Davide Guolo

TonyC,
I am sure the actual problem is from the program I am printing out of,
because if I print a test page, or out of Word, I don't have this problem.

probably your source app. is closing the print job at the end of each line,
so a job is spooled for every printed line.
Is there some way to configure the print to file to append all the text to a
single file as it receives text?

No, as far as I know.
I might be able to add printer codes to the end of the lines being sent from
the program I am printing from.

So, you are probably printing from a DOS app. In this case you could give
the prindir9 utility ( http://www.simtel.net/pub/dl/49062.html ) a go
around. This utility captures the LPT output to a file of your choice
without the need for redirecting the jobs by the Generic / Text only driver.

Kind regards,
Davide Guolo
--------------------------------------------------------------
Printfil - Windows Printing System for Applications
http://www.guolo.com/printfil
Odbc4All - Connection to ODBC Data Sources for any Application
http://www.guolo.com/odbc4all
--------------------------------------------------------------
 
G

Guest

I am not working out of a DOS application. The program I am printing out of
is a Windows application. Your suggestion of the Prindir9 utility program
looks exacly like the sort of solution I need, except I need something that
will operate out of Windows.

Any additional ideas would be appreciated.
 
D

Davide Guolo

TonyC,
I am not working out of a DOS application. The program I am printing out of
is a Windows application. Your suggestion of the Prindir9 utility program
looks exacly like the sort of solution I need, except I need something that
will operate out of Windows.

It's not easy to suggest you something without knowing some details about
the printing app.
Is it a GUI or Console Mode app.?
Why does it spools a job for every printed line ?
Do you know the details about the printing process (by the app.) ?
Are you the original programmer ?
In which language is it written ?

I think on some situation Prindir9 could works also with Windows
applications. Unlike other utilities (prn2file for example), it has a wide
sort of parameters you could test.

Let us know.

Kind regards,
Davide Guolo
--------------------------------------------------------------
Printfil - Windows Printing System for Applications
http://www.guolo.com/printfil
Odbc4All - Connection to ODBC Data Sources for any Application
http://www.guolo.com/odbc4all
--------------------------------------------------------------
 
D

Davide Guolo

TonyC,
The program I am printing out of is RSView Machine Edition by Rockwell
Automation.

Ok. I saw it at http://www.ab.com/viewanyware/enterprise.html
I don't know any details about the printing process, or why it spools a job
for every line.

nor do I, but if printing to the Generic/Text Only on the File: port do not
works, then I would try to setup the Text printer to LPT1: or LPT2: and
redirect the LPT output to a file with Prindir9.
With a little of luck it could work.

Alternatively you could try to write a small utility or batch file which
continuously look for the output file (containing only one line) and append
it to a destination file. I would take this only as the last chance anyway.

Regards,
Davide.
--------------------------------------------------------------
Printfil - Windows Printing System for Applications
http://www.guolo.com/printfil
Odbc4All - Connection to ODBC Data Sources for any Application
http://www.guolo.com/odbc4all
--------------------------------------------------------------
 
R

ray

I don't normally drop into this newsgroup, but while I was researching
something else, I ran across your post. I have some information that
might help. This is based on general printing but may be possible to
port to printing to a file.

The printing a page per line is MS's standard operation for the VB and
VBA object. See MS's technote 175083 - How To Print Line-by-Line to a
Printer. In that technote they describe an alternative and how you can
do it via the Win32API. There could be a base for what you are looking
for in there.

Another quick and dirty option that might work is is to use the RSView
ME activeX control "Program Launch" (see RA TN A20818). Assign a string
tag and stuff it with this:

Cmd.Exe /c echo {your message here} >prn


I think the control should accept this shelled out command. The >PRN is
to direct to a printer. You can replace it withexisting file. If the file does not already exist, the file is created
and subsequent writes are appended.


This does bypass the automatic pagefeed.

Some things to be aware of:

This won't work for the embedded OS versions of RSViewME.

If using the ">PRN", make sure you configure the printer in question to
be the default Windows printer.

If using the ">PRN", configure the printer driver to print directly to
the printer.

If using ">>C:\filedirectory\filename.txt", make sure the directory
already exists.

Print failures (such as an off-line or out of paper printer) are
handled by the OS. If there is a failure, the OS presents a
Cancel\Retry prompt after a (configuable) time-out. The time-out period
is set in the printer port configuration. The defaul time is 90
seconds. The OS caches the print jobs until told to cancel them by the
user, or until the problem is corrected. There should be a prompt in
the taskbar if there is an error, but you need to make sure its visible
in your desktop to see it.

Either case, you'll need to test this to make sure it works for your
application. When I looked into this it was for specialized printing an
RSViewSE project. In that case we had some portions running the quick
and dirty method and some using code based on the MS technote.




Good Luck,
Ray

These are my personal opinions and do not reflect those of my employer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top