home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Graphics
/
PPT
/
rexx
/
BatchProcess.prx
< prev
next >
Wrap
Text File
|
1999-12-27
|
4KB
|
215 lines
/*
This is a simple batch-process script that allows
you to specify a directory and process all of them.
Usage:
Put all files to be processed in one directory. Run script.
Known bugs:
- Image name is generated in all caps
- Does not remove previous prefix
- Supports only one effect
- Icons are also processed
- Stops on unknown files
- Does not inform user when finished.
$Id: BatchProcess.prx,v 1.2 1999/12/27 21:45:33 jj Exp jj $
*/
/*-------------------------------------------------------------------*/
/* I suggest you use this header as-is and add your own code below */
OPTIONS RESULTS
SIGNAL ON ERROR
IF ADDRESS() = REXX THEN DO
startedfromcli = 1
ADDRESS PPT
END
ELSE DO
startedfromcli = 0
ADDRESS PPT
END
RESULT = 'no result'
/*-------------------------------------------------------------------*/
tmpfile = "T:ppt_batch_files.tmp"
ASKFILE '"Please give image directory"' DIRONLY
dirname = RESULT
ADDRESS COMMAND
SAY "Source directory is: " dirname
'list ' dirname ' >' tmpfile ' QUICK NOHEAD LFORMAT=%s%s'
ADDRESS PPT
ASKFILE '"Give destination directory"' DIRONLY SAVE INITIALDRAWER "T:"
destdir = RESULT
CALL geteffectname
effectname = RESULT
GETARGS PLUGIN effectname
effectargs = RESULT
SAY "Using arguments for module " effectname ":" effectargs
CALL getiomodulename
iomodulename = RESULT
GETARGS PLUGIN iomodulename
formatargs = RESULT
SAY "Using arguments for module " iomodulename ":" formatargs
IF open( file, tmpfile, 'Read' ) THEN DO
DO WHILE ~eof(file)
filename = readln(file)
SAY 'Loading 'filename
LOADFRAME filename
myframe = RESULT
PROCESS myframe effectname effectargs
FRAMEINFO myframe STEM infostem
CALL savefilename( iomodulename, infostem.name )
destfile = RESULT
destpath = destdir || destfile
SAVEFRAMEAS myframe destpath FORMAT iomodulename formatargs
DELETEFRAME myframe FORCE
END
END
EXIT 0
savefilename : PROCEDURE
ARG fileformat, filename
IOMODULEINFO fileformat STEM iomodinfo
postfix = iomodinfo.preferredpostfix
/* RETURN filename || postfix */
return filename || postfix
/*
* geteffectname : returns the name of an effect. Arguments:
* none.
*/
geteffectname : PROCEDURE
/*
Gather a list of effects available that support
the GetArgs command
*/
LISTEFFECTS STEM effectlist
FX = 1
DO I = 1 TO effectlist.0
EFFECTINFO effectlist.i STEM effectname
IF effectname.getargs ~= 0 THEN DO
getarglist.FX = effectname.name
FX = FX+1
END
END
getarglist.0 = FX - 1
/*
Show the list to the user and ask which effect he wishes to perform.
*/
DO i = 1 TO getarglist.0
IF i = 1 THEN
effectgad.labels = getarglist.i
ELSE
effectgad.labels = effectgad.labels || "|" || getarglist.i
END
effectgad.type = CYCLE
effectgad.popup = 1
ASKREQ '"Please choose an effect"' effectgad
res = RESULT
IF res ~= 0 THEN
EXIT 0 /* User cancelled */
whichfx = effectgad.value + 1
effectname = getarglist.whichfx
return effectname
getiomodulename : PROCEDURE
LISTIOMODULES STEM iomodlist
FX = 1
DO I = 1 TO iomodlist.0
IOMODULEINFO iomodlist.i STEM iomodname
IF iomodname.getargs ~= 0 THEN DO
getarglist.FX = iomodname.name
FX = FX+1
END
END
getarglist.0 = FX - 1
/*
Show the list to the user and ask which effect he wishes to perform.
*/
DO i = 1 TO getarglist.0
IF i = 1 THEN
iomodgad.labels = getarglist.i
ELSE
iomodgad.labels = iomodgad.labels || "|" || getarglist.i
END
iomodgad.type = CYCLE
iomodgad.popup = 1
ASKREQ '"Please choose a saver module"' iomodgad
res = RESULT
IF res ~= 0 THEN
EXIT 0 /* User cancelled */
whichio = iomodgad.value + 1
iomodname = getarglist.whichio
return iomodname
/*-------------------------------------------------------------------*/
/* Again, keep this part intact. This is the error handler. */
ERROR :
ADDRESS PPT
returncode = RC
IF startedfromcli = 1 THEN DO
SAY 'ERROR ' returncode ' on line ' SIGL ': ' RC2
PPT_TO_BACK
END
ELSE
SHOWERROR '"'RC2'"' SIGL
EXIT returncode