; Scheduler Install Utility
;
; (11/29/93)

; *********************
; * Globals           *
; *********************
;
(set ProgName "Scheduler1.0")

(set OSVersion		(/ (getversion) 65536))

(if (< OSVersion 36)
	(
	(abort "This Program requires 2.0 and above.")
	(exit)
	)
)

(
	(set dest_dir
		(askdir
			(prompt "Select where you would like to install Scheduler.")
			(help "This is where Scheduler will be located. You might "
				  "want to put this in your Utility directory, or if "
				  "run as a commodity, place it in your WBStartup drawer")
			(default (expandpath "SYS:"))
		)
	)
	
	(set @default-dest dest_dir)
	(makeassign "SCHEDINSTALL" @default-dest)
	
	(working "Installing Scheduler Program...")
	
	(copyfiles
		(prompt "")
		(help @copyfiles-help)
		(dest @default-dest)
		(source "Scheduler1.0")
		(infos)
	)

;Set up Default Directory

	(set defdir
		(askdir
			(prompt "Select where you wish your default directory to be.")
			(help "This is the directory where your Scheduler files will "
			      "be placed. You might want to put it into the Envarc: "
			      "and make a directory there for the files.")
			(default ("ENVARC:"))
		)
	)
		
	(set defnam
		(askstring
			(prompt "Enter the default name. This will be the name of all "
					"Scheduler files. ")
			(help 	"This name will be used as the base name of all the files "
				    "example.... Default.sch,  Mine.sch, Mine.cal")
		)
	)
	
	(if (= defnam "")
		(set defnam "default")
	)
	
	(tooltype
		(prompt "")
		(help   "")
		(dest ("SCHEDINSTALL:%s" ProgName))
		(settooltype "DEFNAME" ("%s" defnam))
		(settooltype "DEFDRAWER" ("%s" defdir))
	)

	(set samfiles
		(askbool
			(prompt "Do you want to install the sample files?")
			(help "This will install the sample files.")
			(choices "Yes" "No")
			(default 0)
		)
	)
	
	(if (<> samfiles 0)
		(
		(copyfiles
			(prompt "")
			(source "Samples/sample.sch")
			(newname ("%s.sch" defnam))
			(help @copyfiles-help)
			(dest defdir)
			(optional)
		)
		(copyfiles
			(prompt "")
			(source "Samples/sample.cal")
			(help @copyfiles-help)
			(dest defdir)
			(newname ("%s.cal" defnam))
			(optional)
		)
		)
	)

	(set pop
		(askbool
			(prompt "Do you want the window to open upon start?")
			(help @askchoice-help)
			(choices "Yes" "No")
			(default 0)
		)
	)
	(if (<> pop 0)
		(tooltype
			(prompt "")
			(help   "")
			(dest ("SCHEDINSTALL:%s" ProgName))
			(settooltype "POPUP" "yes")
		)
	)
	(if (<> pop 1)
		(tooltype
			(prompt "")
			(help   "")
			(dest ("SCHEDINSTALL:%s" ProgName))
			(settooltype "POPUP" "no")
		)
	)

;Install Doc files????

(procedure setDocsOpt
	(set DocsOpt
		(
		(askoptions
			(prompt "Select the format you wish your documentation to be installed")
			(help @askoption-help)
			(choices
				"Scheduler.guide"
				"Scheduler.doc"
			)
		)
		)
	)
)

	(set docs
		(askbool
			(prompt "Do you want to install the docs?")
			(help @askchoice-help)
			(choices "Yes" "No")
			(default 0)
		)
	)

	(if (<> docs 0)
		(
			(setDocsOpt)
			(set docdir
				(askdir
					(prompt "Select where you would like to install the Documentation.")
					(help "This is where Scheduler docs will be located. ")
					(default @default-dest)
				)
			)
			(if (IN DocsOpt 0)
				(copyfiles
					(prompt "")
					(help @copyfiles-help)
					(source "")
					(dest docdir)
					(choices "Scheduler.guide")
					(infos)
				)
			)
			(if (IN DocsOpt 1)
				(copyfiles
					(prompt "")
					(help @copyfiles-help)
					(source "")
					(dest docdir)
					(choices "Scheduler.doc")
					(infos)
				)
			)
		)
	)
; ***********
; * Cleanup *
; ***********

	(makeassign "SCHEDINSTALL")

)
