home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
biz
/
dfa-2.2.lha
/
DFA
/
Rexx
/
ArexxScripts.lha
/
printlaserlabels.dfa
< prev
next >
Wrap
Text File
|
1994-09-28
|
11KB
|
432 lines
/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by Dirk Federlein
**
** File : printlaserlabels.dfa
** Created on : Wednesday, 23.03.94 21:48:02
** Created by : Dirk Federlein
** Current revision : V2.0
**
**
** Purpose
** -------
** - Prints 3-column laser labels of all selected ('>') addresses.
**
** This script can be used without changes, if you use the following labels:
**
** "Zweckform" No. 3669, 70 x 50.8 mm (15 labels/page)
**
** Furthermore you should select 8 lpi and 12 cpi within your printer
** preferences.
**
** If you prefer another label size, don't worry! It IS possible!
** All you have to do is to play around with the variables set in front of the
** line that starts with: "if ~show(ports ... ".
**
** Please notice that the script tries to keep track of the current label
** position on the sheet. For this the environment variable 'DFA/SHEETOFFSET'
** is used.
**
** The pages are written to files on the ram disk, named 'DFASheet_1.txt',
** 'DFASheet_2.txt', 'DFASheet_3.txt', etc. depending on how many labels you are
** printing. These files are then copied to the printer, if you wish this.
**
** Please notice: Some laser printers (e.g. HP Laserjet IV) seem to remove
** leading carriage returns in the beginning of the page. As I don't have
** such a printer, I cannot test it by myself, but I assume that replacing
** (cr) by (space) (cr) could solve the problem.
**
**
** Revision V2.0
** --------------
** created on Wednesday, 23.03.94 21:48:02 by Dirk Federlein. LogMessage :
** --- Initial release ---
**
*********************************************************************************/
options results
cr = '0A'X
space = ' '
outbody = 'RAM:DFASheet_'
outext = '.txt'
labelspercol = 5
labelsperrow = 3
labelspersheet = labelspercol * labelsperrow
linesperlabel = 16 /* Each label has up to xx lines */
linesfromtop = 6 /* Additional lines counted from the very top of every label */
colsperlabel = 35 /* Number of chars the fit on one label */
labeloffset = 3 /* Space from left edge that shall be empty */
if ~show(ports, DFA) then
exit 10
if open('envhandle', 'ENV:DFA/SHEETOFFSET', 'R') then
do
lnumber = readln('envhandle')
if lnumber > labelspersheet then
lnumber = 1
if lnumber < 1 then
lnumber = 1
/* Must be like below to close the file REALLY */
call close 'envhandle'
end
else
do
lnumber = 1
address command 'setenv' 'DFA/SHEETOFFSET' lnumber
address command 'copy' 'Env:DFA/SHEETOFFSET' 'ENVARC:DFA'
end
sheetnum = 1
outname = outbody||sheetnum||outext
if open('outfile', outname, 'W') = 0 then
do
exit 10
end
else
do
row = (lnumber-1) % labelsperrow
if row > 0 then
do
/* --- insert rows... ------------------------------------------- */
crnum = row * linesperlabel
do i = 1 to crnum
numchars = writech('outfile', cr)
end
end
/* --- Clear buffers ------------------------------------------------ */
col = (lnumber-1) // labelsperrow /* modulo */
adr1.0 = ""
adr1.1 = ""
adr1.2 = ""
adr1.3 = ""
adr1.4 = ""
adr1.5 = ""
adr1.6 = ""
adr2.0 = ""
adr2.1 = ""
adr2.2 = ""
adr2.3 = ""
adr2.4 = ""
adr2.5 = ""
adr2.6 = ""
adr3.0 = ""
adr3.1 = ""
adr3.2 = ""
adr3.3 = ""
adr3.4 = ""
adr3.5 = ""
adr3.6 = ""
currentcol = col+1
currentrow = row+1
FIRST STEM ADR.
if ADR.ADDRESS.24 = 0 then
NEXTSEL STEM ADR.
do while RC = 0
if currentcol = 1 then
do
adr1.0 = "An"
adr1.1 = ADR.ADDRESS.0
adr1.2 = ADR.ADDRESS.1 ADR.ADDRESS.2
adr1.3 = ADR.ADDRESS.3
adr1.4 = ADR.ADDRESS.4
adr1.5 = ADR.ADDRESS.5 ADR.ADDRESS.6||', '||ADR.ADDRESS.7
adr1.6 = ADR.ADDRESS.8
end
if currentcol = 2 then
do
adr2.0 = "An"
adr2.1 = ADR.ADDRESS.0
adr2.2 = ADR.ADDRESS.1 ADR.ADDRESS.2
adr2.3 = ADR.ADDRESS.3
adr2.4 = ADR.ADDRESS.4
adr2.5 = ADR.ADDRESS.5 ADR.ADDRESS.6||', '||ADR.ADDRESS.7
adr2.6 = ADR.ADDRESS.8
end
if currentcol = 3 then
do
adr3.0 = "An"
adr3.1 = ADR.ADDRESS.0
adr3.2 = ADR.ADDRESS.1 ADR.ADDRESS.2
adr3.3 = ADR.ADDRESS.3
adr3.4 = ADR.ADDRESS.4
adr3.5 = ADR.ADDRESS.5 ADR.ADDRESS.6||', '||ADR.ADDRESS.7
adr3.6 = ADR.ADDRESS.8
/* --- Now we have to format each line an write it to the file */
do i = 1 to linesfromtop
numchars = writech('outfile', cr)
end
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.0, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.0, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.0
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.1, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.1, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.1
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.2, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.2, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.2
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.3, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.3, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.3
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.4, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.4, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.4
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.5, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.5, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.5
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.6, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.6, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.6
numchars = writech('outfile', linebuffer cr)
do i = 1 to linesperlabel - 7 - linesfromtop
numchars = writech('outfile', cr)
end
/* --- Clear alread written buffers ------------------------- */
adr1.0 = ""
adr1.1 = ""
adr1.2 = ""
adr1.3 = ""
adr1.4 = ""
adr1.5 = ""
adr1.6 = ""
adr2.0 = ""
adr2.1 = ""
adr2.2 = ""
adr2.3 = ""
adr2.4 = ""
adr2.5 = ""
adr2.6 = ""
adr3.0 = ""
adr3.1 = ""
adr3.2 = ""
adr3.3 = ""
adr3.4 = ""
adr3.5 = ""
adr3.6 = ""
currentrow = currentrow + 1
end
if currentcol = labelsperrow then
currentcol = 1
else
currentcol = currentcol+1
if currentrow = (labelspercol+1) then
currentrow = 1
lnumber = lnumber + 1
/* --- New page: new file ------------------------------------------- */
if lnumber >= labelspersheet+1 then
do
lnumber = 1
close('outfile')
sheetnum = sheetnum + 1
outname = outbody||sheetnum||outext
if open('outfile', outname, 'W') = 0 then
do
exit 10
end
end
/* --- Update env var ----------------------------------------------- */
address command 'setenv' 'DFA/SHEETOFFSET' lnumber
address command 'copy' 'Env:DFA/SHEETOFFSET' 'ENVARC:DFA/SHEETOFFSET'
nextsel STEM ADR.
end
/* --- If a partial line is kept, write it now ---------------------- */
if currentcol > 1 then
do
do i = 1 to linesfromtop
numchars = writech('outfile', cr)
end
linebuffer = copies(' ', labeloffset)
linebuffer = insert(adr1.0, linebuffer, labeloffset, colsperlabel)
linebuffer = insert(adr2.0, linebuffer, colsperlabel+labeloffset, colsperlabel)
linebuffer = linebuffer||' '||adr3.0
numchars = writech('outfile', linebuffer cr)
linebuffer = copies(' ', labeloffset)
l