.key FROM/A,TO/A,NOBORDER/S,NONORMAL/S,NOSELECTED/S,XOFFSET,YOFFSET,BORDERPEN,COLORMAP
.bra {
.ket }

;-----------------------------------------------------------------------;
; NewIconToILBM
; ŻŻŻŻŻŻŻŻŻŻŻŻŻ
; This script converts 'NewIcon' icons to IFF ILBM files.
; It uses the newicon.datatype and dt2iff.
;
; Made by Pascal Hurni the 24-Oct-96, part of the newicon.datatype archive
;-----------------------------------------------------------------------;

;*** Using default ?
IF "{NOBORDER}" EQ ""
IF "{NONORMAL}" EQ ""
IF "{NOSELECTED}" EQ ""
IF "{XOFFSET}" EQ ""
IF "{YOFFSET}" EQ ""
IF "{BORDERPEN}" EQ ""
IF "{COLORMAP}" EQ ""
  ;*** We are using the default prefs file, do the job

  ;*** Do the conversion with DT2IFF
  DT2IFF {FROM} {TO}

  ;*** That's all folks
  Quit

ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF

;*** We are using user options, let's generate the prefs file

FailAt 21

;*** Create this directory if it doesn't exists, and create an empty prefs
;*** file as well
IF NOT EXISTS ENV:DataTypes
  MakeDir ENV:DataTypes
  Echo >ENV:DataTypes/NewIcon.prefs ";Empty NewIcon.prefs file generated by NewIconToILBM"
ENDIF

;*** Save the old prefs (if it exists)
Copy >NIL: ENV:DataTypes/NewIcon.prefs ENV:DataTypes/NewIcon.prefs.old

;*** Creates the prefs file with the arguments
Echo >ENV:DataTypes/NewIcon.prefs  "{NOBORDER} {NONORMAL} {NOSELECTED}"
IF NOT "{XOFFSET}" EQ ""
  Echo >>ENV:DataTypes/NewIcon.prefs "XOFFSET={XOFFSET}"
ENDIF
IF NOT "{YOFFSET}" EQ ""
  Echo >>ENV:DataTypes/NewIcon.prefs "YOFFSET={YOFFSET}"
ENDIF
IF NOT "{BORDERPEN}" EQ ""
  Echo >>ENV:DataTypes/NewIcon.prefs "BORDERPEN={BORDERPEN}"
ENDIF
IF NOT "{COLORMAP}" EQ ""
  Echo >>ENV:DataTypes/NewIcon.prefs "COLORMAP={COLORMAP}"
ENDIF

;*** Do the conversion with DT2IFF
DT2IFF {FROM} {TO}

;*** Restore the old prefs
Copy >NIL: ENV:DataTypes/NewIcon.prefs.old ENV:DataTypes/NewIcon.prefs
Delete >NIL: ENV:DataTypes/NewIcon.prefs.old

