; Scheduler Install Utility
;
; (4/7/94)

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

(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:WBStartup"))
		)
	)
	
	(set @default-dest dest_dir)
	(makeassign "SCHEDINSTALL" @default-dest)
	
	(working "Installing Scheduler Program...")
	
	(copyfiles
		(prompt "")
		(help @copyfiles-help)
		(dest @default-dest)
		(source ProgName)
		(infos)
	)

	(copyfiles
		(prompt "")
		(help @copyfiles-help)
		(dest @default-dest)
		(source "scheduler.prefs")
		(infos)
	)

	(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 "sample.sch")
			(help @copyfiles-help)
			(dest @default-dest)
			(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 "Scheduler1.2.guide")
					(infos)
				)
			)
			(if (IN DocsOpt 1)
				(copyfiles
					(prompt "")
					(help @copyfiles-help)
					(source "")
					(dest docdir)
					(choices "Scheduler1.2.doc")
					(infos)
				)
			)
		)
	)

(set msg1 ("Thanks for using %s" ProgName))

(exit msg1)


; ***********
; * Cleanup *
; ***********

	(makeassign "SCHEDINSTALL")

)
