; installation script for WaveMaker
;
; script version 1.1
;
; 1.0 initial release
;

(set arcpath "RAM:lx")

(set my_help
   (cat
      "Performing this installation will create a new drawer named 'WaveMaker' in the specified path.\n\n"
      "It will also add a required assignment to your user-startup.\n"
      "\n\n"
      @askdir-help
   )
)

(message
   "You will now be asked to give a path in which to install WaveMaker.\n\n"
   "The installation utility will create a new drawer named 'WaveMaker' "
   "in the specified path.\n\n"
   "It will then copy all of its required files into this new drawer.\n\n"
)

; Get the path from the user

(set dest_wm
   (askdir
      (prompt "Where should the WaveMaker drawer be created/installed?")
   	  (help my_help)
   	  (default @default-dest)
   )
)

; Tell the Installer program where the user wants the data

(set @default-dest dest_wm)

(set dest_wm
   (tackon dest_wm "WaveMaker")
)

(makedir dest_wm
	(infos)
)

; Make sure WaveMaker disk 1 is present

(askdisk
   (prompt "Please insert the disk labeled \"WaveMaker1\" (Program Disk) in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker1")
)

(working)

(copyfiles
	(infos)
	(help @copyfiles-help)
	(source "WaveMaker1:lx")
	(dest "RAM:")
)

(copyfiles
	(infos)
	(help @copyfiles-help)
	(source "WaveMaker1:root")
	(pattern "#?")
	(files)
	(dest dest_wm)
)

; create subdirectories

(makedir (tackon dest_wm "WM_Elements"))
(makedir (tackon dest_wm "WM_ElMotions"))
(makedir (tackon dest_wm "WM_Images"))
(makedir (tackon dest_wm "WM_Logos"))
(makedir (tackon dest_wm "WM_Motions"))
(makedir (tackon dest_wm "WM_Scripts&Scenes"))
(makedir (tackon dest_wm "WM_ShotSheets"))
(makedir (tackon dest_wm "WM_Surfaces"))
(makedir (tackon dest_wm "WM_SBPix"))
(makedir (tackon dest_wm "WM_PF"))
(makedir (tackon dest_wm "WM_Misc"))
(makedir (tackon dest_wm "WM_Objects"))
(makedir (tackon dest_wm "WM_Objects/WM_Object_Images"))

; Make sure WaveMaker disk 2 is present

(askdisk
   (prompt "Please insert the disk labeled \"WaveMaker2\" in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker2")
)

(working "\nUnpacking archive of\n"
		 "Miscellaneous files")

(run (cat arcpath " >nil: -m -a -q x WaveMaker2:wm_misc * " (tackon dest_wm "WM_Misc/")))

(working "\nUnpacking archive of\n"
		 "Prefabs")

(run (cat arcpath " >nil: -m -a -q x WaveMaker2:wm_pf * " (tackon dest_wm "WM_PF/")))

(working "\nUnpacking archive of\n"
		 "Objects")

(run (cat arcpath " >nil: -m -a -q x WaveMaker2:wm_objects * " (tackon dest_wm "WM_Objects/")))

; Make sure WaveMaker disk 3 is present

(askdisk
   (prompt "Please insert the disk labeled \"WaveMaker3\" in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker3")
)

(working "\nUnpacking archive of\n"
		 "Element Motions")

(run (cat arcpath " >nil: -m -a -q x WaveMaker3:wm_elmotions * " (tackon dest_wm "WM_ElMotions/")))

(working "\nUnpacking archive of\n"
		 "Elements")

(run (cat arcpath " >nil: -m -a -q x WaveMaker3:wm_elements2 * " (tackon dest_wm "WM_Elements/")))

; Make sure WaveMaker disk 4 is present

(askdisk
   (prompt "Please insert the disk labeled \"WaveMaker4\" in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker4")
)

(working "\nUnpacking archive of\n"
		 "Elements")

(run (cat arcpath " >nil: -m -a -q x WaveMaker4:wm_elements3 * " (tackon dest_wm "WM_Elements/")))

(working "\nUnpacking archive of\n"
		 "Motions")

(run (cat arcpath " >nil: -m -a -q x WaveMaker4:wm_motions * " (tackon dest_wm "WM_Motions/")))

(working "\nUnpacking archive of\n"
		 "Logos")

(run (cat arcpath " >nil: -m -a -q x WaveMaker4:wm_logos * " (tackon dest_wm "WM_Logos/")))

(working "\nUnpacking archive of\n"
		 "Surfaces")

(run (cat arcpath " >nil: -m -a -q x WaveMaker4:wm_surfaces * " (tackon dest_wm "WM_Surfaces/")))

(askdisk
   (prompt "Please insert the disk labeled \"WaveMaker5\" in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker5")
)

(working "\nUnpacking archive of\n"
		 "Elements")

(run (cat arcpath " >nil: -m -a -q x WaveMaker5:wm_elements1 * " (tackon dest_wm "WM_Elements/")))

(working "\nUnpacking archive of\n"
		 "Images")

(run (cat arcpath " >nil: -m -a -q x WaveMaker5:wm_images * " (tackon dest_wm "WM_Images/")))

; Make sure WaveMaker disk 1 is present

(askdisk
   (prompt "Please insert the disk labeled \"WaveMaker1\" in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker1")
)

(working "\nUnpacking archive of\n"
		 "Elements")

(run (cat arcpath " >nil: -m -a -q x WaveMaker1:wm_elements4 * " (tackon dest_wm "WM_Elements/")))

(working "\nUnpacking archive of\n"
		 "Miscellaneous files")

(run (cat arcpath " >nil: -m -a -q x WaveMaker1:wm_misc2 * " (tackon dest_wm "WM_Misc/")))

; Add Assignments to user-startup

(startup "WaveMaker"
	(prompt "Should the required assignment be added to your user-startup?\n")
	(help "WaveMaker requires an assignment, WaveMaker:.\n"
		 "If you choose not to add it to your user-startup file, the following assignment must be made before you attempt to use WaveMaker:\n\n"
		 "Assign WaveMaker: \"" dest_wm "\"\n")
	(command "assign WaveMaker: \"" dest_wm "\"\n")
)

(makeassign "WaveMaker" dest_wm)

; delete 'lx' from ram:

(if (exists arcpath)
	(delete arcpath
		(prompt "Deleting temporary file in " arcpath ".")
		(help @delete-help)
	)
)

(message
   "** IMPORTANT **\n\nBe sure to read the ReadMe file in the WaveMaker: directory BEFORE running WaveMaker.\nBe sure that both the Registration disk and the Program disk (disk 1) are NOT WRITE PROTECTED.\n\n"
)
