
! script name: misc.d/makegif

!A
!A NAME:
!A
!A 	MAKE GIF
!A
!A DESCRIPTION:
!A	
!A	Images are stored in current user directory as 
!A	image1.gif image2.gif etc
!A
!B INSTRUCTIONS:
!B
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: make gif ")

DIM Answer$[256]
DIM Destination$[256]
DIM Store_dir$[256]
DIM Name$[256]
DIM Namelist$[32000]
DIM A$[512]
DEG

! Note: this will make the background transparent when set to 1.
Transparent=0


Namelist$= DirectoryNamesStr("./","*",WsAscending,"image",".gif")
IF NOT POS(Namelist$,"image") THEN 
	Name$="image1.gif"
ELSE
	A$= NextNumberedName(Namelist$,"image",",")
	Name$=A$&".gif"
END IF

Vnum=1

Stat= DisplayMessage("CREATING GIFFILE NAMED: "&Name$)
!Stat= CreatePixmap(Vnum,"xgrabsc"," -cutoff 10 -invert -gif ","-id",Name$)
Stat= CreateGIFFromView(Name$,Vnum)

IF Transparent THEN
	Stat= StartProcess("giftrans -t 0 -o "&Name$&"2 "&Name$)
	Stat= StartProcess("mv "&Name$&"2 "&Name$)
END IF

Leave:!
IF (NOT LEN(Destination$)) THEN
         LOAD "typecontrol"
ELSE
         LOAD Destination$
END IF
END


