home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
system
/
printfiles
/
english
/
example
/
circular.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-02-27
|
4KB
|
94 lines
/* printfiles Arexx Macro */
/* © 1992 by K. Klingbeil */
/* builds circular letters out of a template letter */
/* and a address file */
/* Usage: rx circular <template> <addresses> */
/* IMPORTANT: type the FULL filenames (including path) */
/* for <template> and <addresses> */
/* in this example (and with this disk) the pathnames */
/* would be : */
/* printfiles:printfiles/english/example/template.letter */
/* printfiles:printfiles/english/example/names.dat */
options results /* Ergebnisse anfordern */
if ~show(ports,'PRINTFILES')then do /* Läuft PrintFiles schon ? */
address command 'printfiles' /* wenn nicht, dann ein Startversuch */
address command 'sys:rexxc/WaitForPort PRINTFILES' /* noch ein bisschen abwarten */
end /* Noch'n Versuch */
if ~(show(ports,'PRINTFILES')) then return 5 /* Rückgabewert 5 bei Mißerfolg */
parse arg argumente
letter = subword(argumente,1,1)
names = subword(argumente,2,1)
if letter == '' then
do
say 'template filename missing'
exit
end
if names == '' then
do
say 'address filename missing'
exit
end
port = "TESTPORT"
if ~Show('L',"rexxsupport.library")
then do
addlib('rexxsupport.library',0,-30,0)
end
if Show('L',"rexxsuport.library") then exit
if OpenPort(port)
then do
address printfiles 'replyport TESTPORT'
address printfiles 'replace on'
address printfiles 'ff on'
open('p',names,'r')
do while ~eof('p')
name = readln('p')
street = readln('p')
town = readln('p')
if eof('p')
then do
address printfiles 'removereplace firstname'
address printfiles 'removereplace famname'
address printfiles 'removereplace street'
address printfiles 'removereplace town'
address printfiles 'removereplace mrmss'
ClosePort(port)
exit
end
mrmss = subword(name,1,1)
firstname = subword(name,2,1)
famname = subword(name,3,1)
address printfiles 'removereplace firstname'
address printfiles 'removereplace famname'
address printfiles 'removereplace street'
address printfiles 'removereplace town'
address printfiles 'removereplace mrmss'
dv = 'firstname' firstname
dn = 'famname' famname
mr = 'mrmss' mrmss
st = 'street' street
ot = 'town' town
address printfiles insertreplace dv
address printfiles insertreplace dn
address printfiles insertreplace st
address printfiles insertreplace ot
address printfiles insertreplace mr
address printfiles insfile ''letter
address printfiles 'print'
WaitPkt(port)
p = Getpkt(port);
Reply(p,0)
end
end