/*
 * $VER: SaveRenderedAs_NewIcon.ifx.pre (AutoFX Arexx script) 1.0 (07.11.99) ® 1999 by Przemyslaw 'SENSEI' Gruchala
 *
 * Arexx script for AutoFX. Made for the REDFiX modules package.
 *
 * Based on the SaveRenderedAs_ILBM.ifx.pre written by Thomas Krehbiel
 *
 * Save rendered image as NewIcon. Buffer must be CMAP!
 *
 * Inputs:
 *    Word(Arg(1),1) = Sequence number (?)
 *    Word(Arg(1),2) = Total number of frames (N)
 *
 * Returns:
 *    0 if successful, non-zero on failure
 *
 */

OPTIONS RESULTS

base = 'Autofx_SaveRenderedAsNewIcon_'
seq = WORD(ARG(1),1)

lastpath = GETCLIP(base||'Path'||seq)
lastext  = GETCLIP(base||'Ext'||seq)

IF lastpath = "" THEN DO
   GetPrefs RendPath
   lastpath = result
   END

Gadget.1 = 'STRING  120  5 200 14 "Output Path:" "'lastpath'"'
Gadget.2 = 'FILEREQ 321  5  20 14 "Output Path:" "'lastpath'" AT=1 DIRONLY'
Gadget.3 = 'STRING  120 20 200 14 "New Extension:" "'lastext'"'
Gadget.4 = 'TEXT    120 36   1  1 "(** = current frame number)" 1'
Gadget.5 = 'END'

NewComplexRequest '"Save Rendered Image As Icon/NewIcon"' Gadget 360 53
IF rc ~= 0 THEN EXIT rc

CALL SETCLIP(base||'Path'||seq, result.1)
CALL SETCLIP(base||'Ext'||seq,  result.3)

/* Wymuszamy pojawienie sie GUI za pierwszym razem. */
CALL SETCLIP(base||'GUI'||seq,  "SHOWGUI")

EXIT
