Eddie Monster
23rd August 2002, 19:18
I tried to set up a Baan direct type print device. We are on Baan IVc4 on a Unix platform. The device queue reads:
lp -dislaser -s %s
Everything prints fine. I wanted to also send a copy of the report to another printer and I thought I could get away with this:
lp -dislaser -s %s; lp -dsyslaser -s %s
Nothing prints...
I typed that command line in directly at a command prompt replacing the %s with an actual file name and it printed a copy of the file to both printers...
I wanted to try to get around coding the reports with brp.xxx commands. Any help??
Thanks!
~Vamsi
23rd August 2002, 19:41
Eddie,
I am no expert in these matters. But try with a shell script which has those two commands in sequence.
Brendan Shine
24th August 2002, 00:52
Sounds like what may be happening is by the time the 2nd lp command executes the file has already passed through the spooler.
You might try putting parenthesis (lp;lp) around the command as this will submit it at the same time to the shell.
Or, and this is the approach we use at my company, you might have the print device actually be a shell script. In the script you can first save a copy of the %s file and then you can print multiple copies to whatever printers you want.
If you need more details, send me an e-mail.
Cheers,
Brendan
OmeLuuk
26th August 2002, 11:31
There is processing needed before the Baan files can be printed. The step that causes the problem, is imo the filehandling with filter6.1. This binary transfers the printerindependent tmp####### file in the $BSE/tmp dir into an printerdependent file format that is being passed to the lp command.
For other purposes (explore what code is put in the file exactly by filter6.1) I created this alternative shell script:#!/bin/ksh
# script filter6.1 to catch the argument list,
# inputfile and outputfile from the filter6.1 binary.
# usage:
# $ mv ${BSE}/bin/filter6.1 ${BSE}/bin/filter6.1.org
# $ vi ${BSE}/bin/filter6.1 < copy this textfile
# $ chmod 755 ${BSE}/bin/filter6.1
#
# results:
# - for every run a line is written to ${BSE_TMP}/argfile.filter
# with runnumber and argument line used
# - for every run a file is written to ${BSE_TMP}/input###.filter
# containing the input file used (printer independent format)
# - for every run a file is written to ${BSE_TMP}/output###.filter
# containing the generated output file (printer dependent format)
# where the runnumber is used in the filenames (instead of ###)
#
# DO NOT FORGET to
# $ cp -p ${BSE}/bin/filter6.1.org ${BSE}/bin/filter6.1
# $ rm ${BSE_TMP}/*filter
# when done testing.
# get last runnum
runnum=`basename \`ls ${BSE_TMP}/output???.filter | tail -1\` | cut -c7-9`
# Format number with preceding zero's (illegal becomes 000)
runnum=`printf "%03d" ${runnum}`
# Raise runname with one
let runnum=runnum+1
# Format number with preceding zero's
runnum=`printf "%03d" ${runnum}`
echo ${runnum}: $* >> ${BSE_TMP}/argfile.filter
cp -p ${10} ${BSE_TMP}/input${runnum}.filter
filter6.1.org $*
cp -p ${12} ${BSE_TMP}/output${runnum}.filterAt the point where it comes to copying the outputfile to output${runnum}.filter file you can also put it in the copy queue with a lp command.
This adapted filter6.1 binary (script) will be used by all prints, but you will only want to make copies when you use a certain device: In that case the script should be changed like:filter6.1.org $*
if [ ${2}=SYSCOPY ]
then lp -dsyslaser -s ${12}
fiHope this works ;)
Juergen
26th August 2002, 14:14
below a simple example to print BAAN reports to various printers.
BAAN Setup:
Maintain Device Data (ttaad3100m000):
Device : EDVTEST
Description : Test printer to send Reports to various printers
Device Type : Direct
Locale : ISO-8859-1 Western Europe - 8 bit
Printer
Driver : hp_lj4
Device Queue : /tlf/script/clptest %d %s
Paper Type : A4 A4 format Portrait
Left Margin : 0 Form Feed : No
File
Driver :
Shell Command :
4GL Program :
Argument :
Path :
Change allowed :
Page Length : 0
Script clptest:
#
# @(#) clptest - Example to print BAAN reports to various printers
#
# Parameter given from BAAN:
# $1 - Number of copies
# $2 - Filename ($BSE/tmp/tmp.......)
#
#
TMPFILE=/tmp/lptmp
cat $2 >$TMPFILE
#
#List of printers
lp -d edv01 -n $1 $TMPFILE
#
lp -d edv02 -n $1 $TMPFILE
#
lp -d edv03 -n $1 $TMPFILE
#
This is only a simple example thats works on our Unixware system. Maybe you have to adjust the script for your environment.
Disadvantage:Your printers must use the same driver.
Juergen