; ************************************************
; *
; * $VER: Install_T-Rexx v2.1.4 (1.2.94)
; *
; * This is the installation script for ASDG's T-Rexx Professional 2.1.4.
; *
; * Copyright © 1993-1994 ASDG, Incorporated  All Rights Reserved
; *
; * todo:
; *
; ************************************************


; ****************************
; * Set up some global variables.
; ****************************
;
(set ProductName		"T-Rexx Professional")	; product name
(set ProductNameUS		"T-Rexx_Professional")	; product name (underscore attached)
(set ProductBaseName		"T-Rexx")		; product base name
(set VersionNum			"2.1.4")		; product version number

(set OSVersion			(/ (getversion) 65536))
(set TotalFiles			0)
(set AccumFiles			0)
(set PctDone			0)
(set DisplayReadMe		0)

(set Disk1Name			"T-Rexx_D1")		; actual name of disk 1
(set Disk2Name			"T-Rexx_D2")		; actual name of disk 2
(set Disk3Name			"T-Rexx_D3")		; actual name of disk 3
(set Disk4Name			"T-Rexx_D4")		; actual name of disk 4
(set Disk5Name			"T-Rexx_D5")		; actual name of disk 5

; The following are Toaster-independent versions:
;
(set DiskInstall		Disk1Name)		; installation (main) disk
(set DiskTRexxPgm		Disk1Name)		; T-Rexx_Professional application disk
(set DiskFramestoreFM		Disk1Name)		; FramestoreFM disk
(set DiskTCE			Disk1Name)		; TCE disk
(set DiskFFM			Disk1Name)		; FFM disk
(set DiskProjectEditor		Disk1Name)		; ProjectEditor disk
(set DiskENVTRexx		Disk1Name)		; ENV/T-Rexx default files disk
(set DiskLightTV		Disk1Name)		; LightTV disk
(set DiskFStoIFF		Disk1Name)		; FStoIFF disk
(set DiskFSView			Disk1Name)		; FSView disk
(set DiskSentry			Disk1Name)		; Sentry disk
(set DiskPopTR			Disk1Name)		; Pop_TR disk
(set DiskTCEFont		Disk1Name)		; TCE font disk
(set DiskView			Disk1Name)		; View disk
(set DiskMergeCommands		Disk1Name)		; MergeCommands disk
(set DiskTRexxScripts		Disk1Name)		; Example T-Rexx scripts disk
;
; The following are the Toaster 2.0 compatible versions:
;
(set Disk20PETemplates		Disk1Name)		; PE 2.0 template files disk
(set Disk20ShareFX		Disk1Name)		; ShareFX 2.0 disk
(set Disk20TRexxData		Disk2Name)		; T-Rexx_Data 2.0 files disk
(set Disk20EffectsProjectA	Disk2Name)		; Toaster 2.0 Effects and Project files disk 1
(set Disk20EffectsProjectB	Disk3Name)		; Toaster 2.0 Effects and Project files disk 2
;
; The following are the Toaster 4000/3.x compatible versions:
;
(set Disk4KPETemplates		Disk1Name)		; PE template files disk
(set Disk4KShareFX		Disk1Name)		; ShareFX4000 disk
(set Disk4KTRexxData		Disk4Name)		; T-Rexx_Data4000 files disk
(set Disk4KEffectsProjectA	Disk4Name)		; Toaster 4000 Effects and Project files disk 1
(set Disk4KEffectsProjectB	Disk5Name)		; Toaster 4000 Effects and Project files disk 2
;
; The following will be set based on which Toaster system is selected
; (default to Toaster 2.0 versions):
;
(set DiskTRexxData		Disk20TRexxData)
(set DiskPETemplates		Disk20PETemplates)
(set DiskShareFX		Disk20ShareFX)
(set DiskEffectsProjectA	Disk20EffectsProjectA)
(set DiskEffectsProjectB	Disk20EffectsProjectB)




(procedure setPkgOpts
;
; ****************************
; * Ask the user which parts of the package should be installed.
; ****************************
;
	(
	(set PkgOpts
		(askoptions
			(prompt
				("Select the parts of the %s package you want to install " ProductName)
				"at this time."
			)
			(help
				"This part of the installation procedure lets you select the "
				("parts of the %s package you want to install at this time.\n" ProductName)
				"\n"
				("*** %s\n" ProductName)
				"This option lets you install the main application and support files.  If "
				"you are installing the package for the first time, you must select this option.\n"
				"\n"
				"*** FramestoreFM\n"
				"This option lets you install the FramestoreFM application.  If you select to install "
				"this part of the package, then you MUST install the FStoIFF utility as well (and "
				"place it in the same directory as FramestoreFM).  This utility is required by "
				"FramestoreFM.\n"
				"\n"
				("*** %s Command Editor \n" ProductBaseName)
				("This option lets you install the %s Command Editor (TCE) application, " ProductBaseName)
				"useful for modifying existing programs and command buttons, as well "
				"as creating new ones.\n"
				"\n"
				"Also, a font called TRexx will be installed in your FONTS: directory.  This "
				"font can be used to place text small enough to fit within the command buttons.\n"
				"\n"
				"*** ProjectEditor\n"
				"This option lets you install the ProjectEditor application, useful "
				"for modifying existing and creating new Toaster projects, "
				"creating and modifying effects, as well as converting between "
				"ActionFX/OrganicFX and ANIM files.\n"
				"\n"
				"*** Example Effects and Project\n"
				("This option lets you install some sample Effects and corresponding Project file for use by %s, TCE, and ProjectEditor.\n" ProductName)
				"\n"
				"*** Example ARexx scripts\n"
				("This option lets you install some sample ARexx scripts generated by %s.\n" ProductName)
				"\n"
				"*** FStoIFF\n"
				"This option lets you install the FStoIFF utility, which converts between Framestore and IFF formats.  "
				"If you have selected to install the FramestoreFM application, then you MUST install this utility as well.\n"
				"\n"
				"*** ShareFX\n"
				"This option lets you install the ShareFX utility, which lets you convert your ActionFX and OrganicFX into a "
				"distributable format for use by others.\n"
				"\n"
				"*** LightTV\n"
				"This option lets you install the LightTV utility, which lets you batch convert LightWave frames into DCTV "
				"frames and ANIM files as the frames are generated.  This utility can be considered a specific form of the "
				"more general Sentry utility.\n"
				"\n"
				"*** Sentry\n"
				"This option lets you install the Sentry utility, which allows for automated file processing as files are "
				"generated.\n"
				"\n"
				"*** Pop_TR\n"
				"This option lets you install the Pop_TR commodity, which allows you to switch between the Switcher screen "
				("and the currently active %s application screen.\n" ProductName)
				"\n"
				"*** FSView\n"
				"This option lets you install the FSView utility, a utility which displays a grayscale representation "
				"of Framestore files.  This utility cannot be executed from the Workbench (i.e., it is a CLI-only utility.\n"
				"\n"
				"*** MergeCommands\n"
				"This options lets you install the MergeCommands utility, which lets you combine and merge two existing "
				"T-Rexx.Commands files into a new file.\n"
				"\n"
				"*** ReadMe\n"
				"This option lets you install the ReadMe file from disk 1 "
				"onto your floppy or hard disk to use as a reference.\n"
				"\n"
				@askoptions-help
			)
			(choices
				; bit position 0 -- todo & 1
				;
				("%s" ProductName)

				; bit position 1 -- todo & 2
				;
				"FramestoreFM"

				; bit position 2 -- todo & 4
				;
				("%s Command Editor (TCE)" ProductBaseName)

				; bit position 3 -- todo & 8
				;
				"ProjectEditor"

				; bit position 4 -- todo & 16
				;
				"Example Effects and Project"

				; bit position 5 -- todo & 32
				;
				"Example ARexx scripts"

				; bit position 6 -- todo & 64
				;
				"FStoIFF"

				; bit position 7 -- todo & 128
				;
				"ShareFX"

				; bit position 8 -- todo & 256
				;
				"LightTV"

				; bit position 9 -- todo & 512
				;
				"Sentry"

				; bit position 10 -- todo & 1024
				;
				"Pop_TR"

				; bit position 11 -- todo & 2048
				;
				"FSView"

				; bit position 12 -- todo & 4096
				;
				"MergeCommands"

				; bit position 13 -- todo & 8192
				;
				"ReadMe"
			)
		)
	)
	)
)




(procedure setToasterOpts
;
; ****************************
; * Ask the user which Toaster system they will be using T-Rexx Professional with.
; ****************************
;
	(
	(set ToasterOpts
		(askchoice
			(prompt
				"Select which Video Toaster you have installed in your machine."
			)
			(help
				"You should select the button corresponding to the version of the Toaster software "
				"installed on your system.  Be careful to select the correct option, as this "
				"choice affects how the applications operate.\n"
				"\n"
				"*** Toaster 2.0\n"
				"This option lets you install the Toaster 2.0 compatible applications.\n"
				"\n"
				"*** Toaster 4000 / 3.x\n"
				"This option lets you install the Toaster 4000 / 3.x compatible applications.\n"
				"\n"
				@askchoice-help
			)
			(choices
				; bit position 0 -- todo & 1
				;
				"Toaster 2.0"

				; bit position 1 -- todo & 2
				;
				"Toaster 4000 / 3.x"
			)
		)
	)

	(if (= ToasterOpts 0)
		(
		; Point to the Toaster 2.0 disks
		;
		(set DiskPETemplates		Disk20PETemplates)
		(set DiskShareFX		Disk20ShareFX)
		(set DiskTRexxData		Disk20TRexxData)
		(set DiskEffectsProjectA	Disk20EffectsProjectA)
		(set DiskEffectsProjectB	Disk20EffectsProjectB)

		(run "setenv TOASTER4000 \"\"")

		(set ToasterID			"")
		)
		(
		; Point to the Toaster 4000 disks
		;
		(set DiskPETemplates		Disk4KPETemplates)
		(set DiskShareFX		Disk4KShareFX)
		(set DiskTRexxData		Disk4KTRexxData)
		(set DiskEffectsProjectA	Disk4KEffectsProjectA)
		(set DiskEffectsProjectB	Disk4KEffectsProjectB)

		(run "setenv TOASTER4000 1")
		(run "copy ENV:TOASTER4000 ENVARC:")

		(set ToasterID			"4000")
		)
	)
	)
)


(procedure setDirPath
;
; ****************************
; * Ask the user for a directory name.
; ****************************
;
; these variables must be defined before calling this procedure:
;    setDirPathWhy
;    setDirPathHelp
;    DirPath
;
; this procedure returns the selected directory in DirPath
;
	(
	(set moveon	FALSE)
	(while (NOT moveon)
		(
		(set DirPath
			(askdir
				(prompt	("Please select the directory %s" setDirPathWhy)
				)
				(help	setDirPathHelp
					"\n"
					@askdir-help
				)
				(default DirPath)
			)
		)

		(if (= (exists DirPath) 0)
			(makedir DirPath)
			(set moveon	TRUE)
		)
		)
	)
	)
)


(procedure setDevicePath
;
; ****************************
; * Ask the user for a device name.
; ****************************
;
; these variables must be defined before calling this procedure:
;    setDevicePathWhy
;    setDevicePathHelp
;    DevicePath
;
; this procedure returns the selected directory in DevicePath
;
	(
	(set moveon	FALSE)
	(while (NOT moveon)
		(
		(set DevicePath
			(askdir
				(prompt	("Please select the device %s" setDevicePathWhy)
				)
				(help	setDevicePathHelp
					"\n"
					@askdir-help
				)
				(default DevicePath)
			)
		)

		(if (= (exists DevicePath) 2)
			(set moveon	TRUE)
		)
		)
	)
	)
)


(procedure deleteIfExists
;
; ****************************
; * Delete the given file, if it exists.
; ****************************
;
; these variables must be defined before calling this procedure:
;
;    deleteFileName
;
	(
	(if (= (exists deleteFileName) 1)
		(
		(protect deleteFileName "+rwed")
		(delete deleteFileName)
		)
	)
	)
)


(procedure extractLZFile2Dir
;
; ****************************
; * Extract a single file from an LZ-extractable archive file.
; ****************************
;
;    workingMsg
;    arcFileName
;    srcFileName
;    destDirName
;
	(
	(working workingMsg)
	(set lzrc	(run ("RAM:lhex -qfw=%s x %s \"%s\"" destDirName arcFileName srcFileName)))
	(if (<> lzrc 0)
		(message
			("Error decompressing %s from %s into the %s directory.\n" srcFileName arcFileName destDirName)
			"\n"
			"Be sure that the directory you have specified as the "
			"destination exists and has enough free space in it "
			"to accept new files.  Also be sure that if the file "
			"to be copied already exists, that the existing file "
			"isn't protected from being overwritten or deleted.")
	)
	(if (= 0 (exists (tackon destDirName srcFileName)))
		(abort ("An error occurred during the copying of %s" srcFileName))
	)
	)
)


(procedure dumpLZFile2Dir
;
; ****************************
; * Extract (dump) all files from an LZ-extractable archive file.
; ****************************
;
;    workingMsg
;    arcFileName
;    destDirName
;
	(
	(working workingMsg)
	(set lzrc	(run ("RAM:lhex -qfw=%s x %s" destDirName arcFileName)))
	(if (<> lzrc 0)
		(message
			("Error decompressing %s's files into the %s directory." arcFileName destDirName)
			"\n"
			"Be sure that the directory you have specified as the "
			"destination exists and has enough free space in it "
			"to accept new files.  Also be sure that if the file "
			"to be copied already exists, that the existing file "
			"isn't protected from being overwritten or deleted.")
	)
	)
)


(procedure incrementMeter
;
; ****************************
; * Increment the progress meter indicator.
; ****************************
;
;    addToMeter
;
	(
	(set PctDone	(/ (* AccumFiles 100) TotalFiles))
	(set AccumFiles	(+ AccumFiles addToMeter))
	(complete PctDone)
	)
)


; ****************************
; * T-Rexx Installation routine
; ****************************
;
(procedure TRexxInstall
	(
	; ****************************
	; * Install the Program
	; ****************************
	;
	(makeassign "TREXXINSTALL" TRexxDir)

	(set deleteFileName	"TREXXINSTALL:TRexx Professional")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:TRexx Professional.info")
	(deleteIfExists)

	(set addToMeter	2)
	(incrementMeter)

	(set workingMsg		("Installing %s..." ProductNameUS))
	(set arcFileName	("%s:T-Rexx.lha" DiskTRexxPgm))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)

	(if (= ToasterID "4000")
		(
		(tooltype
			(prompt		"")
			(help		"")
			(dest		("TREXXINSTALL:%s" ProductNameUS))
			(settooltype	"TOASTER4000" "")
		)
		)
		(
		(tooltype
			(prompt		"")
			(help		"")
			(dest		("TREXXINSTALL:%s" ProductNameUS))
			(settooltype	"(TOASTER4000)" "")
		)
		)
	)

	(if (IN PkgOpts 5)					; if installing scripts
		(
		(tooltype
			(prompt		"")
			(help		"")
			(dest		("TREXXINSTALL:%s" ProductNameUS))
			(settooltype	"SCRIPTS" TRexxScriptsDir)
		)
		)
		(
		(tooltype
			(prompt		"")
			(help		"")
			(dest		("TREXXINSTALL:%s" ProductNameUS))
			(settooltype	"(SCRIPTS=REXX:)" "")
		)
		)
	)

	(if (IN PkgOpts 4)					; if installing effects/project
		(
			(set ToasterDeviceDir	(tackon ToasterDevice "Toaster"))
			(tooltype
				(prompt		"")
				(help		"")
				(dest		("TREXXINSTALL:%s" ProductNameUS))
				(settooltype	"TOASTERDIR" ToasterDeviceDir)
			)
		)
	)

	(set deleteFileName	"TREXXINSTALL:CroutonImages.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:CroutonImages20.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:CroutonImagesC.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:CroutonImagesPOS.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:GadgetImages.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:Transition.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:Transition20.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:TransitionC.pic")
	(deleteIfExists)
	(set deleteFileName	"TREXXINSTALL:TransitionPOS.pic")
	(deleteIfExists)

	(if (= (exists "TREXXINSTALL:Examples") 2)
		(
		(protect "TREXXINSTALL:Examples" "+rwed")
		(rename "TREXXINSTALL:Examples" "TREXXINSTALL:Examples1.0")

		(protect "TREXXINSTALL:Examples.info" "+rwed")
		(rename "TREXXINSTALL:Examples.info" "TREXXINSTALL:Examples1.0.info")
		)
	)


	; ****************************
	; * Install the Toaster Notes
	; ****************************
	;
	(makeassign "TREXXINSTALL" TRexxDir)

	(set addToMeter	2)					; ToasterNotes.txt + icon
	(incrementMeter)

	(copyfiles
		(prompt		"Installing Toaster Notes...")
		(help		"")
		(source		("%s:ToasterNotes.txt" DiskInstall))
		(dest		"TREXXINSTALL:")
		(infos)
	)

	(if (= (exists "TREXXINSTALL:ToasterNotes.txt.info") 1)
		(
		(if (>= OSVersion 39)
			(set ReadMeTool	"MultiView")
			(set ReadMeTool	"More")
		)

		(tooltype
			(prompt		"")
			(help		"")
			(dest		"TREXXINSTALL:ToasterNotes.txt")
			(setdefaulttool	ReadMeTool)
			(noposition)
		)
		)
	)
	)
)


; ****************************
; * FramestoreFM Installation routine
; ****************************
;
(procedure FFMInstall
	(
	; ****************************
	; * Install FramestoreFM
	; ****************************
	;
	(makeassign "TREXXINSTALL" FramestoreFMDir)

	(set addToMeter	2)
	(incrementMeter)

	(set workingMsg		"Installing FramestoreFM...")
	(set arcFileName	("%s:FramestoreFM.lha" DiskFFM))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * TCE Installation routine
; ****************************
;
(procedure TCEInstall
	(
	(makeassign "TREXXINSTALL" TCEDir)

	(set addToMeter	2)
	(incrementMeter)

	(set workingMsg		"Installing TCE...")
	(set arcFileName	("%s:TCE.lha" DiskTCE))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * PE Installation routine
; ****************************
;
(procedure PEInstall
	(
	(makeassign "TREXXINSTALL" PEDir)

	(set addToMeter	2)
	(incrementMeter)

	(set workingMsg		"Installing ProjectEditor...")
	(set arcFileName	("%s:ProjectEditor.lha" DiskProjectEditor))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * ProjectEditor Templates Installation routine
; ****************************
;
(procedure PETemplatesInstall
	(
	(makeassign "TREXXINSTALL" PETemplatesDir)

	(set addToMeter	1)					; PE Templates files
	(incrementMeter)

	(set workingMsg		"Installing ProjectEditor Template Files...")
	(set arcFileName	("%s:PETemplates%s.lha" DiskPETemplates ToasterID))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * T-Rexx_Data Installation routine
; ****************************
;
(procedure TRexxDataInstall
	(
	; ****************************
	; * Create the T-Rexx_Data directory and install the command button files
	; ****************************
	;
	(set TRexxDataDir	(tackon TRexxDir "T-Rexx_Data"))
	(onerror
		(abort	("The %s directory could not be created. " TRexxDataDir)
			"This might be because your destination disk or drawer "
			"has no room or is write protected.  This installation "
			"cannot continue."
		)
	)
	(if (= (exists TRexxDataDir) 0)
		(makedir TRexxDataDir
			(infos))
	)
	(onerror
		(cleanUp)
	)

	(makeassign "TREXXINSTALL" TRexxDataDir)

	(set addToMeter	1)					; T-Rexx_Data files
	(incrementMeter)

	(if (= ToasterID "4000")
		(
		(if (= (exists "TREXXINSTALL:T-Rexx.Commands4000") 1)
			(
			(protect "TREXXINSTALL:T-Rexx.Commands4000" "+rwed")
			(rename "TREXXINSTALL:T-Rexx.Commands4000" "TREXXINSTALL:T-Rexx.Commands4000_2.0")
			)
		)
		)
		(
		(if (= (exists "TREXXINSTALL:T-Rexx.Commands") 1)
			(
			(protect "TREXXINSTALL:T-Rexx.Commands" "+rwed")
			(rename "TREXXINSTALL:T-Rexx.Commands" "TREXXINSTALL:T-Rexx.Commands_2.0")
			)
		)
		)
	)

	(set workingMsg		("Installing %s Data Files and Command Buttons..." ProductBaseName))
	(set arcFileName	("%s:T-Rexx_Data%s.lha" DiskTRexxData ToasterID))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * ENV:T-Rexx Installation routine
; ****************************
;
(procedure ENVTRexxInstall
	(
	; ****************************
	; * Create the ENVARC:T-Rexx directory and install the command button files
	; ****************************
	;
	(set ENVTRexxDir	("ENVARC:%s" ProductBaseName))
	(onerror
		(abort	("The %s directory could not be created. " ENVTRexxDir)
			"This might be because your destination disk or drawer "
			"has no room or is write protected.  This installation "
			"cannot continue."
		)
	)
	(if (= (exists ENVTRexxDir) 0)
		(makedir ENVTRexxDir)
	)
	(onerror
		(cleanUp)
	)

	(makeassign "TREXXINSTALL" ENVTRexxDir)

	(set addToMeter	1)					; ENV:T-Rexx default files
	(incrementMeter)

	(set workingMsg		("Installing ENVARC:%s default files..." ProductBaseName))
	(set arcFileName	("%s:ENV_T-Rexx.lha" DiskENVTRexx))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)


	; ****************************
	; * Create the ENV:T-Rexx directory and install the command button files
	; ****************************
	;
	(set ENVTRexxDir	("ENV:%s" ProductBaseName))
	(onerror
		(abort	("The %s directory could not be created. " ENVTRexxDir)
			"This might be because your destination disk or drawer "
			"has no room or is write protected.  This installation "
			"cannot continue."
		)
	)
	(if (= (exists ENVTRexxDir) 0)
		(makedir ENVTRexxDir)
	)
	(onerror
		(cleanUp)
	)

	(makeassign "TREXXINSTALL" ENVTRexxDir)

	(set workingMsg		("Installing ENV:%s default files..." ProductBaseName))
	(set arcFileName	("%s:ENV_T-Rexx.lha" DiskENVTRexx))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * Effects and Project Installation routine
; ****************************
;
(procedure EffectsProjectInstall
	(
	(set arcFileName	("%s:EffectsProjectA.lha" DiskEffectsProjectA))
	(copyfiles
		(prompt "")
		(help "")
		(source arcFileName)
		(dest "RAM:")
	)
	(if (= 1 (exists "RAM:EffectsProjectA.lha"))
		(set arcFileName	"RAM:EffectsProjectA.lha")
	)

	(set addToMeter	1)					; 1 operation
	(incrementMeter)

	(makeassign "PROJECTINSTALL"	(tackon ToasterDevice "Project"))

	(set workingMsg		"Installing example Project file...")
	(set srcFileName	"100.PJ.AllNew")
	(set destDirName	"PROJECTINSTALL:")
	(extractLZFile2Dir)

	(makeassign "EFFECTSINSTALL"	(tackon ToasterDevice "Toaster/Effects"))

	(set destDirName	"RAM:")
	(set effectCurrN	0)
	(while (set srcFileName (select effectCurrN
			"ASDG"
			"Boing"
			"CamToLeft"
			"CamToRight"
			"Cascade"
			"Cascade2"
			"Cascade3"
			"Cascade4"
			"Cascade5"
			"Cascade6"
			"Cow"
			"CutToLeft"
			"CutToRight"
			"FlyBy"
			"Greyhound"
			"Grid"
			"HandToBot"
			"HandToLeft"
			"HandToRight"
			"HandToTop"
			"KAirBrush"
			"MasterCard"
			"NewSoft_L&R2"
			"New_SoftL&R"
			"PlaneBottom"
			"PlaneLeft"
			"PlaneRight"
			"PlaneTop"
			"Rocket"
			"SoftArc-L"
			"SoftArc-R"
			"SoftBars"
			"SoftSplit"
			"Soft_BL-TL_Diag"
			"Soft_BL-TR.NEW"
			"Soft_BL_BR"
			"Soft_BL_TL"
			""))
		(set workingMsg ("Installing %s Effect..." srcFileName))
		(extractLZFile2Dir)

		(run ("RAM:%s EFFECTSINSTALL:" srcFileName))
		(if (= 0 (exists ("EFFECTSINSTALL:%s" srcFileName)))
			(message
				("\nError installing %s Effect into:\n%s\n" srcFileName (tackon ToasterDevice "Toaster/Effects"))
				"\n"
				"Press Proceed to skip this effect, or Abort Install to terminate the installation process.")
		)

		(set deleteFileName	("RAM:%s" srcFileName))
		(deleteIfExists)

		(set effectCurrN	(+ effectCurrN 1))
	)

	(set deleteFileName	"RAM:EffectsProjectA.lha")
	(deleteIfExists)

	(set arcFileName	("%s:EffectsProjectB.lha" DiskEffectsProjectB))
	(copyfiles
		(prompt "")
		(help "")
		(source arcFileName)
		(dest "RAM:")
	)
	(if (= 1 (exists "RAM:EffectsProjectB.lha"))
		(set arcFileName	"RAM:EffectsProjectB.lha")
	)
	(set effectCurrN	0)
	(while (set srcFileName (select effectCurrN
			"Soft_BR-TL.NEW"
			"Soft_BR-TR_Diag"
			"Soft_BR_Quad"
			"Soft_BR_TR"
			"Soft_T2B"
			"Soft_TL-BL_Diag"
			"Soft_TL-BR.NEW"
			"Soft_TL_TR"
			"Soft_TR-BL.NEW"
			"Soft_TR-TL_Diag"
			"Star"
			"Sunglasses"
			"TruckLeft"
			"TruckRight"
			"Tunnel"
			"WeirdOne"
			"Wheel"
			"XmasTree"
			""))
		(set workingMsg ("Installing %s Effect..." srcFileName))
		(extractLZFile2Dir)

		(run ("RAM:%s EFFECTSINSTALL:" srcFileName))
		(if (= 0 (exists ("EFFECTSINSTALL:%s" srcFileName)))
			(message
				("\nError installing %s Effect into:\n%s\n" srcFileName (tackon ToasterDevice "Toaster/Effects"))
				"\n"
				"Press Proceed to skip this effect, or Abort Install to terminate the installation process.")
		)

		(set deleteFileName	("RAM:%s" srcFileName))
		(deleteIfExists)

		(set effectCurrN	(+ effectCurrN 1))
	)

	(set deleteFileName	"RAM:EffectsProjectB.lha")
	(deleteIfExists)
	)
)


; ****************************
; * Effects and Project (Toaster 4000) Installation routine
; ****************************
;
(procedure EffectsProject4000Install
	(
	(set arcFileName	("%s:EffectsProjectA%s.lha" DiskEffectsProjectA ToasterID))
	(copyfiles
		(prompt "")
		(help "")
		(source arcFileName)
		(dest "RAM:")
	)
	(if (= 1 (exists ("RAM:EffectsProjectA%s.lha" ToasterID)))
		(set arcFileName	("RAM:EffectsProjectA%s.lha" ToasterID))
	)

	(set addToMeter	1)					; 1 operation
	(incrementMeter)

	(makeassign "PROJECTINSTALL"	(tackon ToasterDevice "Project"))

	(set workingMsg		"Installing example Project file...")
	(set srcFileName	"100.PJ.AllNew")
	(set destDirName	"PROJECTINSTALL:")
	(extractLZFile2Dir)

	(makeassign "EFFECTSINSTALL"	(tackon ToasterDevice "Toaster/Effects"))

	(set destDirName	"RAM:")
	(set effectCurrN	0)
	(while (set srcFileName (select effectCurrN
			"ASDG"
			"Boing"
			"CamToLeft"
			"CamToRight"
			"Cascade"
			"Cascade2"
			"Cascade3"
			"Cascade4"
			"Cascade5"
			"Cascade6"
			"Cow"
			"CutToLeft"
			"CutToRight"
			"FlyBy"
			"Greyhound"
			"Grid"
			"HandToBot"
			"HandToLeft"
			"HandToRight"
			"HandToTop"
			"KAirBrush"
			"MasterCard"
			"NewSoft_L&R2"
			"New_SoftL&R"
			"PlaneBottom"
			"PlaneLeft"
			"PlaneRight"
			"PlaneTop"
			"Rocket"
			"SoftArc-L"
			"SoftArc-R"
			"SoftBars"
			"SoftSplit"
			""))
		(set workingMsg ("Installing %s Effect..." srcFileName))
		(extractLZFile2Dir)

		(run ("RAM:%s EFFECTSINSTALL:" srcFileName))
		(if (= 0 (exists ("EFFECTSINSTALL:%s" srcFileName)))
			(message
				("\nError installing %s Effect into:\n%s\n" srcFileName (tackon ToasterDevice "Toaster/Effects"))
				"\n"
				"Press Proceed to skip this effect, or Abort Install to terminate the installation process.")
		)

		(set deleteFileName	("RAM:%s" srcFileName))
		(deleteIfExists)

		(set effectCurrN	(+ effectCurrN 1))
	)

	(set deleteFileName	("RAM:EffectsProjectA%s.lha" ToasterID))
	(deleteIfExists)

	(set arcFileName	("%s:EffectsProjectB%s.lha" DiskEffectsProjectB ToasterID))
	(copyfiles
		(prompt "")
		(help "")
		(source arcFileName)
		(dest "RAM:")
	)
	(if (= 1 (exists ("RAM:EffectsProjectB%s.lha" ToasterID)))
		(set arcFileName	("RAM:EffectsProjectB%s.lha" ToasterID))
	)
	(set effectCurrN	0)
	(while (set srcFileName (select effectCurrN
			"Soft_BL-TL_Diag"
			"Soft_BL-TR.NEW"
			"Soft_BL_BR"
			"Soft_BL_TL"
			"Soft_BR-TL.NEW"
			"Soft_BR-TR_Diag"
			"Soft_BR_Quad"
			"Soft_BR_TR"
			"Soft_T2B"
			"Soft_TL-BL_Diag"
			"Soft_TL-BR.NEW"
			"Soft_TL_TR"
			"Soft_TR-BL.NEW"
			"Soft_TR-TL_Diag"
			"Star"
			"Sunglasses"
			"TruckLeft"
			"TruckRight"
			"Tunnel"
			"WeirdOne"
			"Wheel"
			"XmasTree"
			""))
		(set workingMsg ("Installing %s Effect..." srcFileName))
		(extractLZFile2Dir)

		(run ("RAM:%s EFFECTSINSTALL:" srcFileName))
		(if (= 0 (exists ("EFFECTSINSTALL:%s" srcFileName)))
			(message
				("\nError installing %s Effect into:\n%s\n" srcFileName (tackon ToasterDevice "Toaster/Effects"))
				"\n"
				"Press Proceed to skip this effect, or Abort Install to terminate the installation process.")
		)

		(set deleteFileName	("RAM:%s" srcFileName))
		(deleteIfExists)

		(set effectCurrN	(+ effectCurrN 1))
	)

	(set deleteFileName	("RAM:EffectsProjectB%s.lha" ToasterID))
	(deleteIfExists)
	)
)


; ****************************
; * T-Rexx Scripts Installation routine
; ****************************
;
(procedure TRexxScriptsInstall
	(
	(makeassign "TREXXINSTALL" TRexxScriptsDir)

	(set addToMeter	1)					; 1 operation
	(incrementMeter)

	(set workingMsg		"Installing Example ARexx Scripts...")
	(set arcFileName	("%s:T-Rexx_Scripts.lha" DiskTRexxScripts))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * FStoIFF Installation routine
; ****************************
;
(procedure FTIInstall
	(
	(makeassign "TREXXINSTALL" FStoIFFDir)

	(set addToMeter	2)					; FStoIFF + icon
	(incrementMeter)

	(set workingMsg		"Installing FStoIFF utility...")
	(set arcFileName	("%s:FStoIFF.lha" DiskFStoIFF))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * ShareFX/ShareFX4000 Installation routine
; ****************************
;
(procedure SFXInstall
	(
	(makeassign "TREXXINSTALL" ShareFXDir)

	(set addToMeter	2)					; ShareFX (or ShareFX4000) + icon
	(incrementMeter)

	(set workingMsg		"Installing ShareFX utility...")
	(set arcFileName	("%s:ShareFX%s.lha" DiskShareFX ToasterID))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * LightTV Installation routine
; ****************************
;
(procedure LTVInstall
	(
	(makeassign "TREXXINSTALL" LightTVDir)

	(set addToMeter	2)					; LightTV + icon
	(incrementMeter)

	(set workingMsg		"Installing LightTV...")
	(set arcFileName	("%s:LightTV.lha" DiskLightTV))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * Sentry Installation routine
; ****************************
;
(procedure SentryInstall
	(
	(makeassign "TREXXINSTALL" SentryDir)

	(set addToMeter	2)					; Sentry + icon
	(incrementMeter)

	(set workingMsg		"Installing Sentry...")
	(set arcFileName	("%s:Sentry.lha" DiskSentry))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * Pop_TR Installation routine
; ****************************
;
(procedure PTRInstall
	(
	(makeassign "TREXXINSTALL" PopTRDir)

	(set addToMeter	2)					; Pop_TR + 1 icon
	(incrementMeter)

	(set workingMsg		"Installing Pop_TR commodity...")
	(set arcFileName	("%s:Pop_TR.lha" DiskPopTR))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * View Installation routine
; ****************************
;
(procedure ViewInstall
	(
	(makeassign "TREXXINSTALL" ViewDir)

	(set addToMeter	4)					; View/icon + docs/icon
	(incrementMeter)

	(set workingMsg		"Installing View utility...")
	(set arcFileName	("%s:View.lha" DiskView))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * FSView Installation routine
; ****************************
;
(procedure FSVInstall
	(
	(makeassign "TREXXINSTALL" FSViewDir)

	(set addToMeter	1)					; FSView
	(incrementMeter)

	(set workingMsg		"Installing FSView utility...")
	(set arcFileName	("%s:FSView.lha" DiskFSView))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * TCE Font Installation routine
; ****************************
;
(procedure TCEFontInstall
	(
	(makeassign "TREXXINSTALL" TCEFontDir)

	(set addToMeter	1)					; TCE Font
	(incrementMeter)

	(set workingMsg		"Installing T-Rexx font for TCE...")
	(set arcFileName	("%s:TCEFont.lha" DiskTCEFont))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * MergeCommands Installation routine
; ****************************
;
(procedure MergeCommandsInstall
	(
	(makeassign "TREXXINSTALL" MergeCommandsDir)

	(set addToMeter	1)					; MergeCommands utility
	(incrementMeter)

	(set workingMsg		"Installing MergeCommands utility...")
	(set arcFileName	("%s:MergeCommands.lha" DiskMergeCommands))
	(set destDirName	"TREXXINSTALL:")
	(dumpLZFile2Dir)
	)
)


; ****************************
; * ReadMe Installation routine
; ****************************
;
(procedure ReadMeInstall
	(
	(makeassign "TREXXINSTALL" ReadMeDir)

	(set addToMeter	2)					; ReadMe + icon
	(incrementMeter)

	(copyfiles
		(prompt		"Installing ReadMe file...")
		(help		"")
		(source		("%s:ReadMe" DiskInstall))
		(dest		"TREXXINSTALL:")
		(newname	("ReadMe_%s_%s" ProductBaseName VersionNum))
		(infos)
	)

	(if (= (exists ("TREXXINSTALL:ReadMe_%s_%s.info" ProductBaseName VersionNum)) 1)
		(
		(if (>= OSVersion 39)
			(set ReadMeTool	"MultiView")
			(set ReadMeTool	"More")
		)

		(tooltype
			(prompt		"")
			(help		"")
			(dest		("TREXXINSTALL:ReadMe_%s_%s" ProductBaseName VersionNum))
			(setdefaulttool	ReadMeTool)
			(noposition)
		)
		)
	)
	)
)


; ****************************
; * General CleanUp routine
; ****************************
;
(procedure cleanUp
	(
	; ****************************
	; * remove temporary assignment
	; ****************************
	;
	(makeassign "TREXXINSTALL")
	(makeassign "EFFECTSINSTALL")
	(makeassign "PROJECTINSTALL")


	; ****************************
	; * delete temporary files.
	; ****************************
	;
	(set deleteFileName	"RAM:lhex")
	(deleteIfExists)
	(set deleteFileName	"RAM:EffectsProjectA.lha")
	(deleteIfExists)
	(set deleteFileName	"RAM:EffectsProjectB.lha")
	(deleteIfExists)
	(set deleteFileName	"RAM:EffectsProjectA4000.lha")
	(deleteIfExists)
	(set deleteFileName	"RAM:EffectsProjectB4000.lha")
	(deleteIfExists)


	; ****************************
	; * exit the program.
	; ****************************
	;
	(if (= DisplayReadMe 1)
		(
		(if (= serializeAfterInstall 1)
			(
			(message
				("Once the Proceed button is pressed, the %s application will be run so that you may serialize the %s applications.\n" ProductNameUS ProductName)
				"\n"
				("This panel will stay up until you exit the %s application, so to remove it " ProductNameUS)
				("you should exit out of %s once the serialization process has completed.\n" ProductNameUS)
				"\n\n"
				"Press the Proceed button to serialize the applications, or Abort Install to exit before serialization can begin.\n")
			(execute ("RAM:startT-Rexx \"%s\"" TRexxDir))
			)
		)

		(if (< OSVersion 37)
			(run ("c:run %s:C/More %s:ReadMe" DiskInstall DiskInstall))
			(if (>= OSVersion 39)
				(run ("run SYS:Utilities/MultiView %s:ReadMe" DiskInstall))
				(run ("run %s:C/More %s:ReadMe" DiskInstall DiskInstall))
			)
		)

		(set deleteFileName	"RAM:startT-Rexx")
		(deleteIfExists)
		)
	)

	(complete 100)

	(if (= DisplayReadMe 1)
		(exit)
		(exit (quiet))
	)
	)
)


; *************************************************************************
; *                         ACTUAL START OF SCRIPT
; *
; * Ask all questions for the user now, do all of the work later.
; *************************************************************************
;

(onerror
	(cleanUp)
)

; ****************************
; * set the default destination to SYS:Toaster (if it doesn't).
; ****************************
;
(set @default-dest	"SYS:Toaster")
(set TRexxDir		@default-dest)
(set TRexxUtilDir	TRexxDir)

(setPkgOpts)
(setToasterOpts)


; ****************************
; * if (PkgOpts & 0), ask the user where to install ProductBaseName
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 0)						; if bit position 0 is on
	(
	(set continueOn		0)
	(while (<> continueOn 1)
		(
		(set setDirPathWhy	("where you want to install the %s application." ProductBaseName))
		(set setDirPathHelp 	("This part of the installation is asking you where you would like to place the %s application and its support files.  If you previously owned %s, then select the directory where the application is currently located.\n" ProductName ProductName))
		(set DirPath		@default-dest)
		(setDirPath)

		(if (= 1 (askbool
				(prompt	("\n%s and its modules will be installed in the following directory:\n\n%s\n\n\nIs this correct?" ProductBaseName DirPath))
				(help	("This panel displays what you have told the Installer is the directory where %s files will be installed. " ProductBaseName)
					"It is so that you know exactly where the files will be placed.\n"
					"\n"
					"To select a different directory, press the No button. Otherwise, press the "
					"Yes button to proceed with the installation process.\n"
					"\n"
					@askbool-help)))
			(set continueOn		1)
		)
		)
	)

	(set TRexxDir		DirPath)
	(set @default-dest	TRexxDir)

	(set TotalFiles		(+ TotalFiles 2))		; T-Rexx + icon
	(set TotalFiles		(+ TotalFiles 1))		; T-Rexx_Data files
	(set TotalFiles		(+ TotalFiles 1))		; ENV:T-Rexx default files
	(set TotalFiles		(+ TotalFiles 2))		; ToasterNotes.txt + icon

	(if (= @user-level 2)
		(
		(set serializeAfterInstall (askbool
			(prompt		("\n\nDo you want to serialize the %s applications after installing them?" ProductName))
			(help		("The %s, FramestoreFM, and ProjectEditor applications need to be serialized before " ProductName)
					"can be run.  Also, all three applications need to be installed in the same directory "
					"to serialize properly.\n"
					"\n"
					@askbool-help)
			(default	1)))
		)
		(set serializeAfterInstall 1)
	)
	)
	(
	(set setDirPathWhy	"where the T-Rexx applications will be placed.")
	(set setDirPathHelp	"There are various T-Rexx Professional applications which need to be in the same directory.  You should choose a directory where you can easily find these T-Rexx files.  If you are unsure where to place them, you might want to try your Toaster directory.  Select the Show Drives button to find it.")
	(set DirPath		@default-dest)
	(setDirPath)

	(set TRexxDir		DirPath)
	(set @default-dest	TRexxDir)
	)
)


; ****************************
; * if (PkgOpts & 1), ask the user where to install FramestoreFM,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 1)						; if bit position 1 is on
	(
	(set FramestoreFMDir	TRexxDir)

	(set TotalFiles	(+ TotalFiles 2))			; FramestoreFM + icon
	)
)


; ****************************
; * if (PkgOpts & 2), ask the user where to install TCE,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 2)						; if bit position 2 is on
	(
	(set TCEDir		TRexxDir)

	(set TotalFiles	(+ TotalFiles 2))			; TCE + icon

	(set TCEFontDir		"FONTS:")

	(set TotalFiles	(+ TotalFiles 1))			; TCE Font
	)
)


; ****************************
; * if (PkgOpts & 3), ask the user where to install ProjectEditor,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 3)						; if bit position 3 is on
	(
	(set PEDir		TRexxDir)

	(set TotalFiles	(+ TotalFiles 2))			; ProjectEditor + icon

	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the template files for creating Effects.")
		(set setDirPathHelp 	"If you are unsure where to place these templates, simply use the default Selected Drawer.  It will be placed in the same directory as ProjectEditor.\n")
		(set DirPath		PEDir)
		(setDirPath)

		(set PETemplatesDir	DirPath)
		)
		(
		(set PETemplatesDir	PEDir)
		)
	)
	(set TotalFiles	(+ TotalFiles 1))			; PE Templates

	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the View utility.")
		(set setDirPathHelp 	("The View utility needs to be somewhere in the search path for commands.  The default of %s should already be in your computer system's search path.\n"))
		(set DirPath		TRexxDir)
		(setDirPath)

		(set ViewDir		DirPath)
		(set TRexxUtilDir	ViewDir)
		)
		(
		(set ViewDir		TRexxDir)
		)
	)
	(set TotalFiles	(+ TotalFiles 4))			; View/icon + docs/icon
	)
)


; ****************************
; * if (PkgOpts & 4), ask the user where to install the example Effects and Project,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 4)						; if bit position 4 is on
	(
	(set ToasterDevice	("%s:" (getdevice TRexxDir)))

	(set continueOn		0)
	(while (<> continueOn 1)
		(
		(set setDevicePathWhy	"where your Toaster directory is located.")
		(set setDevicePathHelp 	"The device you specify here should contain the Toaster directory/drawer.  Devices that contain complete Toaster installations contain a Project directory, as well as a Toaster directory and an Effects subdirectory within that.\n")
		(set DevicePath		ToasterDevice)
		(setDevicePath)
		(set ToasterDevice	("%s:" (getdevice DevicePath)))

		(if (AND (AND (= 2 (exists (tackon ToasterDevice "Project"))) (= 2 (exists (tackon ToasterDevice "Toaster/Effects")))) (= 1 (exists (tackon ToasterDevice "Toaster/Effects/Arrow"))))
			(
			(if (= 1 (askbool
					(prompt	("Your specified Toaster device is:\n\n%s\n\n" ToasterDevice)
						("and contains the following subdirectories:\n\n%s\n%s\n\n\nUse this Toaster device?" (tackon ToasterDevice "Toaster/Effects") (tackon ToasterDevice "Project")))
					(help	"This panel displays what you have told the Installer is your Toaster device "
						("It is within this device's Project directory and Toaster/Effects subdirectory where %s's sample " ProductBaseName)
						"effects and project will be installed.\n"
						"\n"
						"To select a different device, press the No button. Otherwise, press the "
						"Yes button to proceed with the installation process.\n")))
				(set continueOn		1)
			)
			)
			(
			(if (= 0 (askbool
					(prompt	("***** ERROR *****\n\n%s\n\n" ToasterDevice)
						("does not contain the required subdirectories:\n\n%s\n%s\n\nand the required model effect.\n\nTry again?" (tackon ToasterDevice "Toaster/Effects") (tackon ToasterDevice "Project")))
					(help	"You have selected a device which does not seem to be a valid Toaster device "
						"(i.e., either or both of the Effects and Project subdirectories do not exist).  You must "
						"select a device which contains these subdirectories in order to properly install the "
						"example effects and project.  The model effect which comes with the Toaster 2.0 software must "
						"also be in the Effects directory for the installation to succeed.\n"
						"\n"
						"To select a different device, press the Yes button. Otherwise, press the "
						"No button to abort the installation process.\n")))
				(cleanUp)
			)
			)
		)
		)
	)

	(run ("setenv TOASTERDIR %s" (tackon ToasterDevice "Toaster")))

	(set TotalFiles	(+ TotalFiles 2))			; Effects + Project
	)
)


; ****************************
; * if (PkgOpts & 5), ask the user where to install the example ARexx scripts,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 5)						; if bit position 5 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the example ARexx scripts.")
		(set setDirPathHelp	"Although you can place these scripts anywhere, the default of REXX: is beneficial in that the Rexx interpreter will be able to find these ARexx scripts without you having to specify the exact location of the script when invoking it.\n")
		(set DirPath		(tackon TRexxDir "T-Rexx_Scripts"))
		(setDirPath)
		(set TRexxScriptsDir	DirPath)
		)
		(
		(if (= (exists (tackon TRexxDir "T-Rexx_Scripts")) 0)
			(
			(makedir (tackon TRexxDir "T-Rexx_Scripts"))
			(if (= (exists (tackon TRexxDir "T-Rexx_Scripts")) 0)
				(set TRexxScriptsDir	"REXX:")
				(set TRexxScriptsDir	(tackon TRexxDir "T-Rexx_Scripts"))
			)
			)
			(set TRexxScriptsDir	(tackon TRexxDir "T-Rexx_Scripts"))
		)
		)
	)

	(set TotalFiles		(+ TotalFiles 1))		; 1 operation
	)
)


; ****************************
; * if (PkgOpts & 6), ask the user where to install FStoIFF,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 6)						; if bit position 6 is on
	(
	(set FStoIFFDir		TRexxDir)

	(set TRexxUtilDir	FStoIFFDir)
	(set TotalFiles		(+ TotalFiles 2))		; FStoIFF + icon
	)
)


; ****************************
; * if (PkgOpts & 7), ask the user where to install ShareFX,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 7)						; if bit position 7 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	("where you want to install the ShareFX%s utility." ToasterID))
		(set setDirPathHelp 	("If you are unsure where to place this utility, simply use the default Selected Drawer.  It will be placed in the same directory as %s (if selected to be installed).\n" ProductName))
		(set DirPath		TRexxUtilDir)
		(setDirPath)

		(set ShareFXDir		DirPath)
		)
		(set ShareFXDir		TRexxUtilDir)
	)
	(set TRexxUtilDir	ShareFXDir)
	(set TotalFiles		(+ TotalFiles 2))		; ShareFX/ShareFX4000 + icon
	)
)


; ****************************
; * if (PkgOpts & 8), ask the user where to install LightTV,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 8)						; if bit position 8 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the LightTV utility.")
		(set setDirPathHelp	("If you are unsure where to place this utility, simply use the default Selected Drawer.  It will be placed in the same directory as %s (if selected to be installed).\n" ProductName))
		(set DirPath		TRexxUtilDir)
		(setDirPath)

		(set LightTVDir		DirPath)
		)
		(set LightTVDir		TRexxUtilDir)
	)
	(set TRexxUtilDir	LightTVDir)
	(set TotalFiles		(+ TotalFiles 2))		; LightTV + icon
	)
)


; ****************************
; * if (PkgOpts & 9), ask the user where to install Sentry,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 9)						; if bit position 9 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the Sentry utility.")
		(set setDirPathHelp	("If you are unsure where to place this utility, simply use the default Selected Drawer.  It will be placed in the same directory as %s (if selected to be installed).\n" ProductName))
		(set DirPath		TRexxUtilDir)
		(setDirPath)
		(set SentryDir		DirPath)
		)
		(set SentryDir		TRexxUtilDir)
	)
	(set TRexxUtilDir	SentryDir)
	(set TotalFiles		(+ TotalFiles 2))		; Sentry + icon
	)
)


; ****************************
; * if (PkgOpts & 10), ask the user where to install Pop_TR,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 10)						; if bit position 10 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the Pop_TR commodity.")
		(set setDirPathHelp	"If you are unsure where to place this commodity, simply use the default Selected Drawer.  This will initiate the commodity during boot-up time.  If you do not want to enable it all the time, then you can select the SYS:Tools/Commodities drawer.\n")
		(set DirPath		"SYS:WBStartup")
		(setDirPath)

		(set PopTRDir		DirPath)
		)
		(set PopTRDir		"SYS:WBStartup")
	)
	(set TotalFiles		(+ TotalFiles 2))		; Pop_TR + icon
	)
)


; ****************************
; * if (PkgOpts & 11), ask the user where to install the FSView utility,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 11)						; if bit position 11 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the FSView utility.")
		(set setDirPathHelp	"If you are unsure where to place this utility, simply use the default Selected Drawer of SYS:Utilities.\n")
		(set DirPath		TRexxUtilDir)
		(setDirPath)

		(set FSViewDir		DirPath)

		(set TotalFiles		(+ TotalFiles 1))	; FSView
		)
		(set FSViewDir		TRexxUtilDir)
	)
	)
)


; ****************************
; * if (PkgOpts & 12), ask the user where to install the MergeCommands utility,
; * but don't actually do it yet.
; ****************************
;
(if (IN PkgOpts 12)						; if bit position 12 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the MergeCommands utility.")
		(set setDirPathHelp	"If you are unsure where to place this utility, simply use the default Selected Drawer of SYS:Utilities.\n")
		(set DirPath		TRexxUtilDir)
		(setDirPath)

		(set MergeCommandsDir	DirPath)

		(set TotalFiles		(+ TotalFiles 1))	; MergeCommands
		)
		(set MergeCommandsDir	TRexxUtilDir)
	)
	)
)


; ****************************
; * if (PkgOpts & 13), ask the user where to install the package's ReadMe file
; * from disk 1.
; ****************************
;
(if (IN PkgOpts 13)						; if bit position 13 is on
	(
	(if (= @user-level 2)
		(
		(set setDirPathWhy	"where you want to install the ReadMe file.")
		(set setDirPathHelp	"Although the ReadMe file will be displayed at the end of the installation process, you should install it onto your floppy or hard disk for future reference.  There is a lot of important information in the ReadMe which for one reason or another was left out of the manual.\n")
		(set DirPath		TRexxDir)
		(setDirPath)

		(set ReadMeDir		DirPath)

		(set TotalFiles		(+ TotalFiles 2))	; ReadMe + icon
		)
		(set ReadMeDir		TRexxDir)
	)
	)
)


(set TotalFiles	(+ TotalFiles 1))				; lhex


(complete 0)

(message "\nShall I proceed with the installation?"
	(help	"Once you press the Proceed button, the selected items will be installed.  This is your last chance "
		"to abort this procedure without partially installing the selected files.\n"
		"\n"
		"After you press Proceed, you can use the Esc key to abort the installation procedure.\n")
)


; ****************************
; * copy the startT-Rexx script so that we don't need to do it later.
; ****************************
;
(copyfiles
	(prompt	"")
	(help	"")
	(source	("%s:startT-Rexx" DiskInstall))
	(dest	"RAM:")
	(infos)
)


; ****************************
; * copy lhex to the RAM: directory.
; ****************************
;
(set addToMeter	1)
(incrementMeter)

(copyfiles
	(prompt	"")
	(help	"")
	(source	("%s:C/lhex" DiskInstall))
	(dest	"RAM:")
)
(onerror
	(cleanUp)
)


(if (IN PkgOpts 0)
	(
	(TRexxInstall)
	(ENVTRexxInstall)
	)
)
(if (IN PkgOpts 1)
	(FFMInstall)
)
(if (IN PkgOpts 2)
	(TCEInstall)
)
(if (IN PkgOpts 3)
	(PEInstall)
)
(if (IN PkgOpts 3)
	(PETemplatesInstall)
)
(if (IN PkgOpts 5)
	(TRexxScriptsInstall)
)
(if (IN PkgOpts 6)
	(FTIInstall)
)
(if (IN PkgOpts 7)
	(SFXInstall)
)
(if (IN PkgOpts 8)
	(LTVInstall)
)
(if (IN PkgOpts 9)
	(SentryInstall)
)
(if (IN PkgOpts 10)
	(PTRInstall)
)
(if (IN PkgOpts 11)
	(FSVInstall)
)
(if (IN PkgOpts 3)
	(ViewInstall)
)
(if (IN PkgOpts 2)
	(TCEFontInstall)
)
(if (IN PkgOpts 12)
	(MergeCommandsInstall)
)
(if (IN PkgOpts 0)
	(TRexxDataInstall)
)
(if (IN PkgOpts 4)
	(if (= ToasterID "4000")
		(EffectsProject4000Install)
		(EffectsProjectInstall)
	)
)
(if (IN PkgOpts 13)
	(ReadMeInstall)
)

(set DisplayReadMe	1)
(cleanUp)
