; ImageFX UnInstall Utility
;
; Written by Thomas Krehbiel
; Copyright  1995 Nova Design, Inc.
;

(

   ;================================================================
   ; Setup
   ;================================================================

   ; script variables...

   (set programname "ImageFX")               ; name of program
   (set assignname "ImageFX")                ; assignment

   ; system information...

   (set osver (/ (getversion) 65536))        ; os version
   (set cputype (database "cpu"))            ; cpu type

   ;-------------------
   ; Pick a default directory for the installation...
   (set initialdir @default-dest)            ; defaults to biggest drive
   (if (getassign "ImageFX")
      (
         (set initialdir (getassign "ImageFX"))
      )
      ; else
      (
         (if (getassign "ImageFX2")
            (
               (set initialdir (getassign "ImageFX2"))
               (set assignname "ImageFX2")
            )
         )
      )
   )

   ;-------------------
   ; Ask where to (un)install from...
   (set wheredir
      (askdir
         (prompt "Please confirm the directory containing the " programname
                 " software you would like to remove.")
         (help "Locate the directory containing the version of " programname
               "you would like to remove.")
         (default initialdir)
      )
   )

   ; I wish there was some way we could read the tool type to get the assign
   ; name... oh well.

   (if (> @user-level 1)
      (
         (set theassign
            (askstring
               (prompt "Confirm the Assign name for this ImageFX drawer: "
                       "(Do NOT include a trailing colon (:)!)")
               (help @askstring-help)
               (default assignname)
            )
         )
      )
      ; else
      (
         (set theassign assignname)
      )
   )

   (message "ALL components of ImageFX in the drawer " wheredir " will now "
            "be removed.  To abort, click on `Abort Install' now.")

   ; Remove the assign so we can delete the directory
   (run ("Assign %ls:" theassign))

   (run ("delete %ls all quiet" wheredir))
   (delete ("%ls.info" wheredir))
   (delete "libs:thumbnail.library")
   (delete "sys:wbstartup/MagicServer")
   (delete "sys:wbstartup/MagicServer.info")

   ; Remove stuff from user-startup
   (startup theassign
      (prompt "Somes lines pertaining to ImageFX will now be removed from your user-startup file.")
      (help @startup-help)
      (command "")
   )

   ; There is also ImageFX information in ENV:AmigaGuide/Path which should
   ; be removed.  Unfortunately there is no way to do this with an installer
   ; script.

   ; Installation complete!
)

;-----------------------------------------------------------------------
; Revision History:
;
;  03.03.95 tek   Created.
;  11.04.95 tek   Cleaned up for beta release.
