AREXX Script for ADPro
11-Mar-93 00:51:59
Sb: #52580-AREXX Script for ADPro
Fm: Bill Eastburn 70007,1657
To: Geary N. Hughes 70455,446
Geary,
The following script is a little rough around the edges, but it does work.
/* iffbatch.adpro */
/* Converts a directory of IFF images to GIF format without intervention. GIF
image sizes will be same as IFF size.
This file was designed to be invoked by the RX command on a CLI/Shell
line. */
/* Requires REXXARPLIB.library, available in AmigaTech. */
/* Std. startup. */
if ~show('l','rexxsupport.library') then call
addlib('rexxsupport.library',0,-30,0)
if ~show('l','rexxarplib.library') then call
addlib('rexxarplib.library',0,-30,0)
options results
x = 1
homedir = getfile(0.0)
if homedir = '' then exit
homedir1 = left(homedir, length(homedir)-1)
/* Don't click on a filename, just get into the directory where the files to
be
converted are kept. */
/* Creating the list of files to be converted in RAM */
address command "list >ram:temp" homedir1 "files lformat=%N"
foo = open(inf,'ram:temp')
do until eof(inf)
y = readln(inf)
if eof(inf) then leave
cvtfil.x = y
giffil.x = y||'.GIF'
x = x+1
end
/* Using a slightly modified version of ASDG's example script Locate ADPro to
load find and load ADPro in for use. */
CALL Locate_ADPro
IF RESULT = 1 THEN SAY "ADPro has been found"
ELSE SAY "Could not locate or start ADPro"
/* Moving ADPro to front to watch progress and Setting load and save formats
*/
Address 'ADPro'
ADPro_to_Front
LFORMAT "IFF"
SFORMAT "GIF"
/* The conversion loop */
do i = 1 to x-1
load homedir||cvtfil.i
render_type 256
execute
save homedir||giffil.i "image" "256 Color" xsize "by" ysize "Image"
end
/* Cleanup and Exit */
ADPRO_EXIT
say x-1 'images converted'
exit
Locate_ADPro:
Max_Seconds_To_Load = 60
Flag = 0
LibName = 'rexxsupport.library'
IF POS(LibName , SHOW('Libraries')) = 0 THEN ADDLIB(LibName , 0 , -30 , 0)
IF POS(LibName , SHOW('Libraries')) = 0 THEN RETURN 0
IF STATEF('adpro:') = "" THEN RETURN 0
TIME('R')
DO WHILE (Time('E') < Max_Seconds_To_Load) & (POS('ADPro' , SHOW('Ports')) =
0)
IF Flag = 0 THEN DO
/* Set whatever command line arguments you want. */
ADDRESS COMMAND 'run < nil: > nil: adpro:adpro BEHIND MAXMEM=5000000'
Flag = 1
END
ADDRESS COMMAND 'WAIT 1'
END
IF POS('ADPro' , SHOW('Ports')) = 0 THEN RETURN 0
ELSE RETURN 1