/*
 * $VER: SaveBufferAs_ILBM+A.ifx.pre 2.5 (11.04.96)
 * Copyright © 1992-1996 Nova Design, Inc.
 * Written by Thomas Krehbiel
 *
 * Save main buffer as ILBM w/Alpha Channel.
 *
 * 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_SaveBufferAsILBMalf_'
seq  = WORD(ARG(1),1)

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

IF lastext = "" & lastpath = "" THEN lastext = ".24"

IF lastpath = "" THEN DO
   GetPrefs SavePath
   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 Buffer As ILBM w/Alpha"' Gadget 360 55
IF rc ~= 0 THEN EXIT rc

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

EXIT
