(set TRUE 1)
(set FALSE 0)

(set docopylibs TRUE)

(makeassign "SuperDisk" "SuperDisk40:")
 
(set m1 "\n\n\n\nYou are about to use the\n\nAMIGA USER INTERNATIONAL\n\n")
(set m2 "SuperDisk Installation Utility\n")
(set m3 "\n\n\n\n\nYou have selected the install to Ram Disk option.")
(set m4 "\n\n\n\n\nYou have selected the install to Hard Disk option.")
(set m5 "\n\nYou have selected the install to Floppy Disk option.\n\n")
(set m6 "You will need to have two or three blank formatted disks ")
(set m7 "ready for use.\n\n\n")
(set m8 "If you do not have any disks ready, format some now and then ")
(set m9 "click on \"Proceed\"")
(set m10 "\n\n REMEMBER the Amiga is a multitasking computer!")

(message m1 m2)

(set installto
   (askchoice
      (prompt "Select the type of disk you\nwant to install to\n")
      (default 0)
      (choices "Ram Disk" "Hard Disk" "Floppy Disk")
      (help @askchoice-help)
   )
)

(if (= installto 0 )
   (message m3 )
)
(if (= installto 1 )
   (message m4 )
)
(if (= installto 2 )
   (message m5 m6 m7 m8 m9 m10 )
)

(set loopy 1)

(while (= loopy 1)
   (set installfile
      (askfile
               (prompt "Please select file to decrunch")
               (default "SuperDisk:Programs")
               (help @askfile-help)
      )
   )

   (set installdest
      (askdir
         (prompt "Into which drawer should\n" (fileonly installfile) "\n be installed?")
         (help @askdir-help)
         (if (= installto 0 )
            (default "Ram:")
         )
         (if (= installto 1 )
            (default "Sys:")
         )
         (if (= installto 2 )
            (default "DF0:")
         )
      )
   )

   (set endof

      (strlen installdest)
   )

   (set endof (- endof 1))

   (set lastchar
      (substr installdest endof)
   )

   (if (<> lastchar ":")
       (set idest (cat installdest "/"))
       (set idest installdest)
   )

   (set installdest idest)

   (set lhacommands (cat '"'installfile'"' ' ' '"'installdest'"'))
   (message "\n\n\n\n\nYou are about to execute the command\nSuperDisk:C/LhA x "lhacommands)
   (set @default-dest installdest)
   (run "SuperDisk:C/LhA -x x "lhacommands)

   (set loopy
      (askbool
         (prompt "\n\n\n\n\nWould you like to decrunch any more programs?")
         (default 0)
         (help "Explanation of controls:\n    Select \"Yes\" or \"No\"")
      )
   )
)

(if (= docopylibs TRUE)
   (set libyn
         (askbool
            (prompt "\n\n\n\n\nWould you like to install/update any libraries?")
            (default 0)
            (help "Explanation of controls:\n    Select \"Yes\" or \"No\"")
         )
   )
)

(if (= libyn TRUE)
   (copyfiles
      (prompt "Please select a file to copy")
      (help @copyfiles-help)
      (source "SuperDisk:Libs")
      (dest "Libs:")
      (files)
      (pattern "#?.library")
      (optional "askuser")
      (confirm)
   )
)

(exit "Operation completed")
