home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 July
/
AMIGA_1996_7.BIN
/
patches
/
pagestream
/
3.0cfupdate
/
macros.lha
/
PrintMacros.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-09-25
|
4KB
|
120 lines
/* $VER: PrintMacros.rexx 1.0 (02.25.94)
Copyright 1994 Soft-Logik Publishing Corporation
May not be distributed without Soft-Logik Publishing Corporation's express written permission */
OPTIONS RESULTS
ADDRESS 'PAGESTREAM'
/* Make sure rexx support is opened */
if ~show('L','rexxsupport.library') then
call addlib('rexxsupport.library',0,-30)
/* GIVE INSTRUCTIONS */
allocarexxrequester '"Print Macro Documentation"' 544 101
reqhandle=result
addarexxgadget reqhandle EXIT 12 84 70 label "_Ok"
Okhandle=result
addarexxgadget reqhandle EXIT 462 84 70 label "_Cancel"
Cancelhandle=result
addarexxgadget reqhandle TEXT 8 10 528 border none string "'This macro will create a printed copy of the PageStream macro'"
addarexxgadget reqhandle TEXT 8 20 528 border none string "'documentation. This information is provided only in help system,'"
addarexxgadget reqhandle TEXT 8 30 528 border none string "'but this macro will print it to your Preference compatible'"
addarexxgadget reqhandle TEXT 8 40 528 border none string "'printer. You must select a printer driver with Sys:Prefs/Printer'"
addarexxgadget reqhandle TEXT 8 50 528 border none string "'before using this macro. Each macro will be printed on a separate'"
addarexxgadget reqhandle TEXT 8 60 528 border none string "'page and there are over 300 macros.'"
doarexxrequester reqhandle
action=result
freearexxrequester reqhandle
if action=cancelhandle then exit
/* MAIN LOOP */
page=1
do i=1 to 7
ifilename='PageStream3:Help/PGS.MD'||i
ofilename='ram:PGS.MD'||i
say 'Processing 'ifilename'...'
if ~open(.ifile, ifilename, 'R') then return 9
if ~open(.ofile, ofilename, 'W') then return 8
do ii=1 to 14
call readln(.ifile)
end ii
do until eof(.ifile)
currentline=readln(.ifile)
check=left(currentline,4)
midcheck=substr(currentline,5,9)
select
when check="@nod" then do
parse var currentline dum nodename .
index.page=nodename
call readln(.ifile)
call writeln(.ofile, '- '||page||' -')
call writeln(.ofile, "")
page=page+1
end
when check='@toc' | check='@nex' | check='@pre' | midcheck='Command F' | midcheck='Object ID' | midcheck='DOCUMENT,' then nop
when check='@end' then do
call readln(.ifile)
call writeln(.ofile, d2c(12))
end
otherwise do
call search()
call writeln(.ofile, currentline)
end
end
end
call close(.ifile)
call close(.ofile)
end i
/* INDEX */
say 'Generating Index'
if ~open(.ofile, 'ram:Macro.Index', 'W') then return 8
call writeln(.ofile, 'Macro Index')
do i=1 to page-1
call writeln(.ofile, right(i,3)||'...'||index.i)
end
call close(.ofile)
/* PRINT FILES */
do i=1 to 7
say 'Printing File 'i' of 8'
address command 'copy ram:PGS.MD'i' PRT:'
address command 'delete ram:PGS.MD'i' to PRT:'
end i
address command 'copy ram:Macro.Index PRT:'
address command 'delete ram:Macro.Index'
EXIT
SEARCH:
do count=1 until currentline=''
code=1
/* if there's an AmigaGuide code, find its position */
do while code ~= 0
code=pos('@{',currentline)
if code~=0 then do
type1=upper(substr(currentline,code,4))
type2=upper(substr(currentline,code,6))
if c2d(substr(currentline,code+2,1))=34 then do
currentline=left(currentline,code-1)||right(currentline,length(currentline)-code-2)
endnode=pos(d2c(34),currentline,code)
endlink=pos('}',currentline,endnode)
currentline=left(currentline,endnode-1)||right(currentline,length(currentline)-endlink)
end
else do
select
when type1='@{U}' | type1='@{B}' then chop=3
when type1='@{UU' | type1='@{UB' then chop=4
when type2='@{FG H' then chop=14
when type2='@{FG T' then chop=9
otherwise nop
end
currentline=left(currentline,code-1)||right(currentline,length(currentline)-code-chop)
end
end
end
Return