[alt.sources.amiga] Label maker

new@udel.edu (Darren New) (10/06/90)

/* pack.rexx */
/* Packs up a set of label.ps files into one page */

/*
 ****************************************************************

This is a little hack I wrote over the course of a few days. A little
while ago, I lost some CDs at a party because they wound up in the
wrong CD box. I decided I needed some way to label them (and other
stuff). I wanted the labels to be elegant yet custom. This program is
part of my solution.

I bought some laser-printer labels (i.e., labels that don't stick to
the printer guts :-) that were 1" by 4". (I would have bought 1" by
2", but nobody seems to make those.) I realized that 300dpi for a 1"
by 2" square is a snap with DPaint. I drew my pictures and used huge
text (~40 points looks good) on a two-color screen. I took the
resulting ILBMs and ran them through Iff2Ps. This ARexx program reads
in a set of Iff2Ps files (otherwise uneditted) and writes to stdout a
postscript file while tiles the images on the page as specified by the
variables below. (Warning: these output files can get really big!)
Anyway, stick the labels in your printer and pump out your file for
custom labels.

Helpful hints:

Make the picture somewhat smaller than 300x600, as LaserWriters seem
to slip up and down a little. Don't put borders on your images: the
sliding up and down makes whitespace above and below the borders and
looks ugly.  Clipping the original IFF files to the actual 300x600
size (i.e., saving as a brush) does not seem to work for me; I don't
know why because I can't get feedback from my printer. If you use
Avery 5261 labels, make the labels two columns wide instead of four;
run the labels through twice, the second time rotated 180 degrees, so
as to not worry about the separator down the middle. Iff2Ps seems to
GURU at the end of files if you are doing something else at the same
time, so beware.  The output files LZW-compress quite well :-)

For those of us better at drawing with a pencil that a mouse: If you
draw an image by hand, you can use a photocopier to magnify it to the
right size (about 5" by 9" on my screen, or slightly smaller) and then
photocopy it onto an overhead transparency (use the right kind or the
plastic will melt). Cut it out, and stick it to your screen. From that
point, it is fairly simple to manually trace it onto the screen.  I
did this and then cleaned it up using the second smallest brush and
the line and curve tools.

Anyway, I'm really happy with the results. Below is the non-creative
part of the endevor.  Enjoy!            -- Darren New

*/

width = 2
height = 10
copies = 1

firstx = 11
firsty = 37
incrx  = 144
incry  = 72

scalex = 153.6      /* 640 / 600 * 72 */
scaley = 96         /* 400 / 300 * 72 */

/*
filecount = 8

file.1 = 'label5.ps'
file.2 = 'labela.ps'
file.3 = 'label7.ps'
file.4 = 'labelf.ps'
file.5 = 'label2.ps'
file.6 = 'labele.ps'
file.7 = 'label4.ps'
file.8 = 'labelc.ps'
*/

filecount = 4

file.1 = 'label5.ps'
file.2 = 'label7.ps'
file.3 = 'label2.ps'
file.4 = 'label4.ps'



/* * * * * * * * * * * * * * * * */

cr = '0D'x

curfile = 1
curx = firstx
cury = firsty
curw = 1
curh = 1
curlab = 1

say "%!"
say "% Processed by pack.rexx by DHNew"
say "clear"

open(xyzzy, 'CON:20/20/400/60/Pack status', 'W')

do outer = 1 until curh > height
    if ~open(inpf, file.curfile, 'R') then
        do
        say 'Could not open' file.curfile
        exit 0
        end
    say "% LABEL" curlab
    do i = 1 by 1 until line = 'showpage'
        if (i // 100) = 1 then
            writeln(xyzzy, 'Working on label' curlab 'file' file.curfile 'line' (i-1))
        line = readln(inpf)
        if line ~= '' then line = left(line, length(line) - 1)
        select
            when line = 'showpage' then
                say "% showpage"
            when line = 'clear' then
                say "% clear"
            when left(line, 3) = "/XS" then
                say "/XS" scalex "def"
            when left(line, 3) = "/YS" then
                say "/YS" scaley "def"
            when left(line, 4) = "/ANG" then
                say "/ANG 0 def"
            when left(line, 3) = "/NC" then
                say "/NC" copies "def"
            when left(line, 3) = "/XT" then
                say "/XT" firstx incrx (curw - 1) "mul add def"
            when left(line, 3) = "/YT" then
                say "/YT" firsty incry (curh - 1) "mul add def"
            otherwise say line
            end
    end
    close(inpf)
    curlab = curlab + 1
    curfile = curfile + 1
    if curfile > filecount then curfile = 1
    curw = curw + 1
    if curw > width then ; do ; curw = 1 ; curh = curh + 1 ; end
end outer

say 'showpage'
say '% End of processed file'

address command 'echo >speak: "All done."'

exit 0

-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee -----