; This is an install script for VideoStage Pro (1 disk version)
;
; The following tooltypes should be on the invocation project icon:
;         MINUSER=AVERAGE
;         APPNAME=VStagePro
;         PRETEND=FALSE      {this is due to fact that lharc will not
;                             follow the pretend mode correctly}
;


(copyfiles
   (source "CU_128:UnLZX")
   (dest "ram:")
   (infos)
)
(copyfiles
   (source "CU_128:Disk.info")
   (dest "ram:")
   (infos)
)
(copyfiles
   (source "CU_128:FilterSettings")
   (dest "ram:")
   (infos)
)
(copyfiles
   (source "CU_128:VSregisterPro")
   (dest "ram:")
   (infos)
)

(onerror
   (delete "ram:UnLZX" (safe))
   (delete "ram:Disk.info" (safe))
   (delete "ram:filtersettings" (safe))
   (delete "ram:vsregisterpp" (safe))
)

(

   (
      (set length_ok 1)

      (set serialno "VS01on10846")

      (set length_ok 1)

      (set name "")

      (while length_ok
         (set name
            (askstring
               (prompt "Please enter your name.  This must be at least 6"
                       " characters long, and less than 40 characters long.")
               (help "Choose any name you wish, but it must be between"
                     " 6 and 40 characters in length")
               (default name)
            )
         )
         (if (< (strlen name) 6)
            (message "name must be at least 6 characters long")
            (if (> (strlen name) 39)
               (message "name must be less than 40 characters long")
               (set length_ok 0)
            )
         )
      )

      (set length_ok 1)

      (set org "")

      (while length_ok
         (set org
            (askstring
               (prompt "Please enter your organization or home town and state."
                       "  This must be at least 6"
                       " characters long, and less than 40 characters long.")
               (help "Choose any organization or home town you wish, but"
                     " it must be between 6 and 40 characters in length")
               (default org)
            )
         )
         (if (< (strlen org) 6)
            (message "organization must be at least 6 characters long")
            (if (> (strlen org) 39)
               (message "organization must be less than 40 characters long")
               (set length_ok 0)
            )
         )
      )
   )

   (set vs_dest (tackon @default-dest "VStage"))

   (set vs_dest
      (askdir
         (prompt "Where would you like to install VideoStage Pro?\n"
                 "(Make sure you specify a sub-directory)"
         )
         (help   "The suggested path is on your volume with the"
                 " most available space.  If you wish it to be"
                 " elsewhere, simply change the name.  If the drawer does"
                 " not exist, it will be added to the indicated"
                 " volume, along with an icon.  Some examples will be"
                 " installed to the same location.  The total installation"
                 ", excluding the fonts placed in fonts:, will be about"
                 " 3.4Mb in length."
         )
         (newpath)
         (default vs_dest)
      )
   )

   (makedir vs_dest (infos))

   (set @default-dest vs_dest)
   (
      (copyfiles
         (source "CU_128:vstagepro.lzx")
         (dest "ram:")
      )
      (working
                 "Decompressing VideoStage program files.\n"
                 "\n****************\n"
                 "Just a minute...\n"
                 "****************"
      )
      (if (run (cat "ram:UnLZX >nil: x ram:vstagepro.lzx #? " vs_dest"/"))
         (abort "Program files Decompression failed")
      )
      (delete "ram:vstagepro.lzx")

      (if (run (cat "ram:vsregisterpro \"" (tackon vs_dest "vstagepro") "\" \"" name "\" \"" org "\" \"" serialno "\""))
         (abort "Program Registration failed")
      )
      (delete "ram:vsregisterpro")
   )
)

(if (exists "CU_128:amigaguide.lzx")
   (if (= (exists "libs:amigaguide.library") 0)
      (
         (if (askbool
               (prompt "Do you wish to install the amigaguide.library"
                       " file into your libs: directory?  This library"
                       " is essential to the operation of the help"
                       " system in VideoStage"
               )
               (help "If you wish to be able to utilize the extensive help"
                     " system provided with VideoStage then you"
                     " should install it."
               )
               (default 1)
            )
            (
               (copyfiles
                  (source "CU_128:amigaguide.lzx")
                  (dest "ram:")
               )
               (working
                          "Decompressing amigaguide library file.\n"
                          "\n****************\n"
                          "Just a minute...\n"
                          "****************"
               )
               (if (run (cat "ram:UnLZX >nil: x ram:amigaguide.lzx #? libs:"))
                  (abort "amigaguide library Decompression failed")
               )
               (delete "ram:amigaguide.lzx")
            )
         )
      )
   )
)
(if (exists "CU_128:destracker.lzx")
   (if (= (exists "libs:destracker.library") 0)
      (
         (if (askbool
               (prompt "Do you wish to install the destracker.library"
                       " file into your libs: directory?  This library"
                       " is essential to the operation of the module"
                       " playing system in VideoStage"
               )
               (help "If you wish to be able to please protracker modules"
                     " in your VideoStage productions then you"
                     " should install it."
               )
               (default 1)
            )
            (
               (copyfiles
                  (source "CU_128:destracker.lzx")
                  (dest "ram:")
               )
               (working
                          "Decompressing destracker library file.\n"
                          "\n****************\n"
                          "Just a minute...\n"
                          "****************"
               )
               (if (run (cat "ram:UnLZX >nil: x ram:destracker.lzx #? libs:"))
                  (abort "destracker library Decompression failed")
               )
               (delete "ram:destracker.lzx")
            )
         )
      )
   )
)

(set anbr_dest (tackon vs_dest "Anbr"))
(makedir anbr_dest (infos))

(
   (
      (
         (copyfiles
            (source "CU_128:anbr.lzx")
            (dest "ram:")
         )
         (working
                    "Decompressing VideoStage animated icon files.\n"
                    "\n****************\n"
                    "Just a minute...\n"
                    "****************"
         )
         (if (run (cat "ram:UnLZX >nil: x ram:anbr.lzx #? " anbr_dest"/"))
            (abort "Demo files Decompression failed")
         )
         (delete "ram:anbr.lzx")
      )
   )
)

(
   (
      (
         (set font_dest "fonts:")

         (copyfiles
            (source "CU_128:fonts.lzx")
            (dest "ram:")
         )
         (working
                    "Decompressing VideoStage font files.\n"
                    "\n****************\n"
                    "Just a minute...\n"
                    "****************"
         )
         (if (run (cat "ram:UnLZX >nil: x ram:fonts.lzx #? " font_dest))
            (abort "Font files Decompression failed")
         )
         (delete "ram:fonts.lzx")
      )
   )
)

(set help_dest (tackon vs_dest "VStagePro.guide"))

(
   (textfile
      (prompt "Do you wish to create the settings file for VideoStage?\n"
              "*******************\n"
              "This is the s:.vstage file used by VideoStage"
              " to provide default settings and paths.")
      (help "The file s:.vstage provides various defaults to the program."
            " Operation will still be ok without it, but some things"
            " (such as the HELP capability) may not work without it")
      (dest "ram:.VStagex")
      (append "VIDEOSTAGE-1\n")
      (append "QRTRANS 0 1 3 3 3 3 4 4 4 4 7 7 7 7 7 7 7 7 7 7\n")
      (append "QRSUBTR 0 0 1 4 7 5 1 3 9 6 3 0 2 1 12 11 5 6 4 7\n")
      (append "QRSPEED 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60\n")
      (append "QRLINE1 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30\n")
      (append "QRLINE2 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70\n")
      (append "GENERICGENLOCK\n")
      (append "PATH<" pic_dest ">\n")
      (append "IFFOPENPATH<" pic_dest ">\n")
      (append "PATH<" back_dest ">\n")
      (append "BACKDROPPATH<" back_dest ">\n")
      (append "PATH<" pattern_dest ">\n")
      (append "PATTERNPATH<" pattern_dest ">\n")
      (append "PATH<" button_dest ">\n")
      (append "BUTTONPATH<" button_dest ">\n")
      (append "AREXXPATH s:\n")
      (append "ASCIIPATH<" ascii_dest ">\n")
      (append "TRANSPATH<" anbr_dest ">\n")
      (append "PATH<" sample_dest ">\n")
      (append "SOUNDPATH<" sample_dest ">\n")
      (append "PATH<" demo_dest ">\n")
      (append "SCRIPTPATH<" demo_dest ">\n")
      (append "HELPFILE<" help_dest ">\n")
      (append "ANTIALIAS 2\n")
      (append "FONT0 VSCoop.font 42 2 34 1 1 6 6 0 10 10 7 2 2 0 0\n")
      (append "FONT1 topaz.font 8 0 66 1 1 6 6 0 10 10 1 2 2 0 0\n")
      (append "END\n")

      (confirm)
   )
)

(run ("ram:filtersettings"))
(delete "ram:.vstagex" (safe))
(delete "ram:filtersettings" (safe))

(
   (
      (copyfiles
         (source "ram:.vstage")
         (dest "s:")
      )
      (delete "ram:.vstage" (safe))
   )
)

(delete "ram:UnLZX" (safe))

(complete 100)

(exit)
