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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer script help

Status
Not open for further replies.

bgarlock

MIS
Jan 23, 2002
173
US
I have read and got a few ideas
for a solution to another one of our software shortcomings. Basically,
each employee is required to log time in various jobs, with activities.
At the end of their shift, a "Shift Summary Report" prints at a printer
we define for the employee with our software. Our plant supervisors,
would also like this report printed in the main production office.
Since our software has no way of doing this, I decided to hack up the
interface script to provide this feature. Here's what I have so far:

from "dumb line printer":

--- various lines cut ---

for file in $files
do
0<${file} eval ${FILTER} 2>&1

# Hack by B. Garlock to print to convt printer if
# report is a Shift Summary

convert=`head -2 $file | grep &quot;Shift Summary
Report&quot; | cut -c57-77`
if [ &quot;$convert&quot; = &quot;Shift Summary Report&quot; ]
then
lp -d convt $file 1>/dev/null 2>&1
fi
--- more lines cut ---


So, the hack properly identifies the proper report, and sends it to the
convt printer, which is what I want. The problem is, that it does not
print in &quot;condensed&quot; mode on the HP laser printer (the convt printer is
a HP Laserjet 2100). It prints fine on the printer when the employee
ends their shift.

The printers that the employees have their Shift Summary's print on, are
dot matrix, so maybe that has something to do with my problem. The
reports properly go into condensed mode on the dot matrix, but not when
I send it to the laser printer using the hack, however they do properly go into condensed mode if I set the laser printer up as the main Shift Summary printer. I'm thinking that I need to pass the file to the other printer in another way, but I'm, not sure how. Bruce Garlock
bruceg@tiac.net
 
don't rember the details but it is something like

echo ` /033/074/c`
lp -dprinter
echo ` /033/075/c`

where the echo strings are the condensed and noncondensed strings from the printer manual.

Guidance for how to set it up is in the termcaps for print on and printoff for say the wyse60 terminal. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
I should have mentioned that I tried a few of these already, and didn't get anywhere. Per HP, the command for condensed is 27,38,107,50,83 I tried that in the echo statement, like this:

echo &quot;\027\038\107\050\083\c&quot;

and got the same results. I then started looking in the /usr/spool/lp/model directory for some more clues, and found the 'HPLaserJet' script, which I started looking through. I then came across a statement that appeared to put the laserjet in condensed mode, and added that string to my script, and it worked! The command is this:

echo &quot;\033&k2S\c&quot;

I have no idea what that means, but it solved my problem. Anyone care to comment on that? Why did HP have 27,38,107,50,83 ??

Thanks,

Bruce Bruce Garlock
bruceg@tiac.net
 
Difference is decimal, hexadecimal, and octal. And remembering which is which is the problem.
Been there, done that. And you duplicated my path of several years ago. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
Maybe you need:
lp -d convt -ocondensed,lpi8,landscape $file 1>/dev/null 2>&1

The -o[ptions] condensed,lpi8,landscape etc are options that get filtered by the relevent printer interface filter(ie. convt) that resides in /var/spool/lp/admins/lp/interfaces

regards,
Gordon Sillifant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top