; installation script for WaveMaker 2.0
;
; script version 1.3
;
; 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 \"WaveMaker2_disk1\" (Program Disk) in any drive.")
   (help @askdisk-help)
   (dest "WaveMaker2_disk1")
)

(working)

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

(makeassign "WaveMaker" 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"))

(working "\nUnpacking archive of\n\n"
		 "Main WaveMaker files")

(run (cat arcpath " >nil: -m -a -q x WaveMaker2_disk1:root * WaveMaker:"))

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

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

; Make sure WaveMaker disk 2 is present

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

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

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

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

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

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

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

; Make sure WaveMaker disk 3 is present

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

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

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

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

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

; Make sure WaveMaker disk 4 is present

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

; 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")
)

; delete 'lx' from ram:

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