home *** CD-ROM | disk | FTP | other *** search
- /*
- * $VER: CreateNails 2.2 (25.7.95)
- *
- * Arexx program for the ImageFX image processing system.
- * Written by Thomas Krehbiel
- *
- * Copyright © 1992-1995 Nova Design, Inc.
- * All Rights Reserved
- *
- * CreateNails - Generate thumbnail files for existing images.
- *
- * 17.01.95 tek Added support for linked thumbnails.
- * 06.06.95 tek Fixed problem handling paths with trailing ":".
- *
- */
-
- OPTIONS RESULTS
-
- SIGNAL ON BREAK_C
-
- loadopt = 'NOALPHA SMOOTH'
-
-
- lpath = GETCLIP('CREATENAILS_Path')
- pattern = GETCLIP('CREATENAILS_Pat')
- bits = GETCLIP('CREATENAILS_Bits')
-
- IF lpath = "" THEN DO
- GetPrefs LoadPath
- lpath = result
- END
- IF bits = "" THEN bits = 24
- IF pattern = "" THEN pattern = '#?'
-
-
- RequestFile '"Select Directory To Convert:"' '"'lpath'"' '" "' '"'pattern'"'
- IF rc ~= 0 THEN EXIT
-
- lpath = filereq.path
- pattern = filereq.pat
-
- IF (RIGHT(lpath,1) ~= ':' & RIGHT(lpath,1) ~= '/') THEN lpath = lpath || '/'
-
- IF pattern = "" THEN pattern = '#?'
-
- RequestThree '"Select Thumbnail Color Depth:"' '"24-Bit"' '"12-Bit"' '"Cancel"'
- IF rc ~= 0 THEN EXIT
-
- IF result = '24-Bit' THEN bits = 24
- IF result = '12-Bit' THEN bits = 12
-
- RequestThree '"Do you want to store the thumbnails in another directory?"' '"Yes"' '"No"' '"Cancel"'
- IF rc ~= 0 THEN EXIT
-
- tpath = ""
-
- IF result = 'Yes' THEN DO
-
- tpath = GETCLIP('CREATENAILS_TPath')
-
- RequestFile '"Select Directory For Thumbnails:"' '"'tpath'"' DIRONLY
- IF rc ~= 0 THEN EXIT
-
- tpath = filereq.path
-
- CALL SETCLIP('CREATENAILS_TPath', tpath)
-
- IF tpath = lpath THEN tpath = ""
-
- END
-
- CALL SETCLIP('CREATENAILS_Path', lpath)
- CALL SETCLIP('CREATENAILS_Pat', pattern)
- CALL SETCLIP('CREATENAILS_Bits', bits)
-
- opts = bits
- IF tpath ~= "" THEN opts = opts || ' "'tpath'"'
-
- /* list all files matching the pattern */
- ADDRESS COMMAND 'List >RAM:__NAILS_TEMP__ NOHEAD LFORMAT="'lpath'%s" PAT="'pattern'" "'lpath'"'
- IF rc ~= 0 THEN DO
- RequestNotify 'Error creating list of files. Error Code' rc'.'
- EXIT
- END
-
- /* sort alphabetically */
- ADDRESS COMMAND 'Sort RAM:__NAILS_TEMP__ TO RAM:__NAILS_LIST__'
- ADDRESS COMMAND 'Delete RAM:__NAILS_TEMP__ QUIET'
-
- IF ~OPEN(infile, 'RAM:__NAILS_LIST__', 'Read') THEN DO
- RequestNotify 'Cannot open file list.'
- EXIT
- END
-
- Undo Off
-
- LockInput
-
-
- /* go through the list one by one */
- DO WHILE ~EOF(infile)
-
- nextfile = READLN(infile)
-
- IF nextfile ~= "" THEN DO
-
- IF RIGHT(nextfile,5)='.info' THEN ITERATE
- IF RIGHT(nextfile,5)='.nail' THEN ITERATE
-
- Message nextfile
-
- LoadBuffer '"'nextfile'"' FORCE loadopt
- IF rc ~= 0 THEN DO
- Message 'LOAD FAILED!'
- ITERATE /* skip to next one anyway */
- END
-
- CreateNailFile '"'nextfile'"' opts
-
- END
-
- END
-
- CALL CLOSE(infile)
-
-
- ADDRESS COMMAND 'Delete RAM:__NAILS_LIST__ QUIET'
-
- KillBuffer Force
- UnlockInput
- Undo On
-
- EXIT
-
-
- /* if script is terminated: */
- BREAK_C:
-
- ADDRESS COMMAND 'c:Delete RAM:__NAILS_LIST__ QUIET'
- KillBuffer Force
- UnlockInput
- Undo On
-
- EXIT
-