;;
;;  $Final Writer 5 Installation Script US English Version $
;;  $Date: 1996/05/21 14:28:56 $
;;  $Revision: 1.3 $
;;

(set is_update 0)
(set @user-level 1)	; force average mode
(complete 0)

; Installation Disk Names
;
(set #install_disk_1 "Disk 1")
(set #install_disk_2 "Disk 2")
(set #install_disk_3 "Disk 3")
(set #install_disk_4 "Disk 4")
(set #install_disk_5 "Disk 5")
(set #install_disk_6 "Disk 6")
(set #install_disk_7 "Disk 7")
(set #install_disk_8 "Disk 8")
(set #install_disk_9 "Disk 9")

; File/drawer names to change with different versions.
;
(set #fw_drawer		"FinalWriter")
(set #old_hyph_file	"FWFiles/eng.hyp")
(set #ud_file			"userdict.eng")
(set #save_ud_file	"userdict.eng.save")
(set #gram_file		"gen3mus0.dat")
(set #oldgram_file	"gen4mus0.dat")

; --------------------------------------------------------------
; TEXT TRANSLATION BEGINS HERE - Translate everything in quotes.
;
(set #which_drawer_prompt
(cat	"In which disk or drawer should the Final Writer drawer be created in?"
))

(set #which_drawer_help
(cat	"The installation utility will create a drawer named \""
		#fw_drawer
		"\" "
		"in the selected drawer. All \"Final Writer\" files will be placed "
		"inside this new drawer.\n\n"
		@askdir-help
))

(set #min_or_comp_prompt
(cat	"Do you wish to do a \"Complete\" or \"Minimal\" installation "
		"of \"Final Writer?\" The complete installation will require "
		"approximately 12 megabytes of free disk space. The minimal "
		"installation will require approximately 5 megabytes of free "
		"disk space."
))

(set #min_or_comp_help
(cat	"Choosing \"Complete\" will install all of the files that are "
		"included in the Final Writer disk set. This will require "
		"approximately 12 megabytes of free disk space. If \"Minimal\" "
		"is choosen, then the ARexx Macros, EPS Clip Art, Extra Fonts, "
		"and Templates will not be installed. The minimal installation "
		" will require approximately 5 megabytes of free disk space."
))

(set #option_complete "Complete")
(set #option_minimal "Minimal")

(set #disk_space_prompt
(cat	"There may not be enough room available on this drive to install "
		"\"Final Writer\".  Do you wish to continue?"
))

(set #disk_space_help
(cat	"Final Writer 5 needs approximately 12 megabytes of disk space for a "
		"complete installation or 5 megabytes for a minimal installation. "
		"If Final Writer is already installed on this partition, you may "
		"wish to continue. Otherwise, press ABORT or NO now and either free "
		"some space on this partition or select a different partition for "
		"the installation."
))

(set #disk_space_abort
(cat	"Final Writer installation cancelled. Not enough disk space on Volume \""
))

(set #update_options_prompt
(cat	"What parts would you like to update?"
))

(set #update_program		"Final Writer Program")
(set #update_macros		"ARexx Macros")
(set #update_sysfiles	"System Data Files")
(set #update_syslibs		"System Libraries")
(set #update_sysfonts	"System Fonts")
(set #update_spellhyph	"Speller & Hyphenation")
(set #update_thes			"Thesaurus")
(set #update_clipart		"EPS Clip Art")
(set #update_xfonts		"Extra Fonts")
(set #update_temps		"Templates")

(set #ask_disk_prompt
(cat	"Please insert the disk labeled \"%s\" in any drive."
))

(set #ask_disk1_help
(cat	"\"%s\" contains the Final Writer data files, libraries, "
		"and system fonts to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk2_help
(cat	"\"%s\" contains the Final Writer speller and hyphenation "
		"files to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk3_help
(cat	"\"%s\" contains the Final Writer thesaurus files and EPS Clip Art "
		"to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk4_help
(cat	"\"%s\" contains EPS Clip Art to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk5_help
(cat	"\"%s\" contains EPS clip art and additional decorative and serif fonts "
		"to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk6_help
(cat	"\"%s\" contains additional serif fonts to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk7_help
(cat	"\"%s\" contains additional sans serif fonts to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk8_help
(cat	"\"%s\" contains the Final Writer program, macros, templates, "
      "and grammar checker files to be installed.\n\n"
		@askdisk-help
))

(set #ask_disk9_help
(cat	"\"%s\" contains grammar checker files to be installed.\n\n"
		@askdisk-help
))

(set #install_program		"Installing Final Writer program from \"%s\".")
(set #install_program_icon	"Installing Final Writer program and icon from \"%s\".")
(set #install_macros			"Installing ARexx Macros from \"%s\".")
(set #install_datafiles		"Installing Data Files from \"%s\".")
(set #install_libs			"Installing Libraries from \"%s\".")
(set #install_sysfonts		"Installing System Fonts from \"%s\".")
(set #install_grammar		"Installing Grammar File from \"%s\".")
(set #combine_grammar		"Combining grammar data files.")
(set #install_spell			"Installing Speller & Hyphenation files from \"%s\".")
(set #install_thes			"Installing Thesaurus files from \"%s\".")
(set #install_clipart		"Installing EPS Clip Art from \"%s\".")
(set #install_deco			"Installing Decorative Fonts from \"%s\".")
(set #install_serif			"Installing Serif Fonts from \"%s\".")
(set #install_sans			"Installing Sans Serif Fonts from \"%s\".")
(set #install_temps			"Installing Document Templates \"%s\".")

(set #install_program_err		"Error installing Final Writer Program.")
(set #install_macros_err		"Error installing ARexx Macros.")
(set #install_datafiles_err	"Error installing Data Files.")
(set #install_libs_err			"Error installing Libraries.")
(set #install_sysfonts_err		"Error installing System Fonts.")
(set #install_gram_part1_err	"Error installing Grammar file part 1.")
(set #install_gram_part2_err	"Error installing Grammar file part 2.")
(set #combine_grammar_err		"Error combining grammar data files.")
(set #install_spell_err			"Error installing Speller & Hyphenation files.")
(set #install_thes_err			"Error installing Thesaurus files.")
(set #install_clipart_err		"Error installing EPS Clip Art.")
(set #install_deco_err			"Error installing Decorative Fonts.")
(set #install_serif_err			"Error installing Serif Fonts.")
(set #install_sans_err			"Error installing Sans serif Fonts.")
(set #install_temps_err			"Error installing Document Templates.")
;
; TEXT TRANSLATION ENDS HERE - nothing below needs translation.
; -------------------------------------------------------------


(set FW_dest
	(askdir
		(prompt	#which_drawer_prompt)
		(help		#which_drawer_help)
		(default @default-dest)
	)
)

; Check if this is an update
; the FWLibs directory is a tell-tale sign
; that FW is already installed here
(if (exists (tackon FW_dest "FWLibs"))
	(set is_update 1)
	(	(if (exists (tackon FW_dest #fw_drawer))
			(set is_update 1)
			(makedir (tackon FW_dest #fw_drawer) (infos))
		)
		(set FW_dest (tackon FW_dest #fw_drawer))
	)
)

(set @default-dest FW_dest)
(set disk_space (getdiskspace FW_dest))

; If first time install ask if user wants complete
; or minimal installation. The minimal installation
; will not install the eps clip art or the extra fonts.
(if (NOT is_update)
	(
		(set install_all
			(askbool
				(prompt	#min_or_comp_prompt)
				(help		#min_or_comp_help)
				(choices #option_complete #option_minimal)
				(default 1)
			)
		)

		(if install_all
			(set disk_space_needed 12582912)	; 12 Megs
			(set disk_space_needed 5242880)	; 5 Megs
		)
	)
)

(if (AND (< disk_space disk_space_needed) (NOT is_update))
	(
		(set answer1
			(askbool
				(prompt #disk_space_prompt)
				(help #disk_space_help)
			)
		)
		(if (NOT answer1)
			(abort #disk_space_abort
					(getdevice @default-dest)
					"\"."
			)
		)
	)
)

; Allow updating user to select what they want updated
(if is_update
	(set install_options
		(askoptions
			(prompt	#update_options_prompt)
			(help		@askoptions-help)
			(choices
				#update_program
				#update_macros
				#update_sysfiles
				#update_syslibs
				#update_sysfonts
				#update_spellhyph
				#update_thes
				#update_clipart
				#update_xfonts
				#update_temps
				)
			(default 543)	; default to Program/Macros/Files/Libs/SysFonts/Templates
		)
	)

	; First time install
	(if install_all
		(set install_options 1023) ; 0x1FF - all options on
		(set install_options 125)	; 0x07D - Macros/EPS/ExtraFonts/Templates off
	)
)

; Copy lhex over and remember where it is
(copyfiles
	(source "Disk 1:lhex")
	(dest FW_dest)
)
(set DeArcher (tackon FW_dest "lhex"))
(set error 0)

; Installing Files on Disk 1?
(if (IN install_options 2 3 4)
	(
		; Get Disk 1
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_1))
			(help		(#ask_disk1_help #install_disk_1))
			(dest		#install_disk_1)
		)

		; Installing FWFiles
		(if (IN install_options 2)
			(
				; If FWFiles doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFiles")))
					(
					(makedir (tackon FW_dest "FWFiles") (infos))
					)
				)

				; Make installer cd into FWFiles when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFiles"))

				; Extract the files
				(working (#install_datafiles #install_disk_1))
				(set error
					(run
						("\"%s\" -f x \"Disk 1:FWFiles.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_datafiles_err)
				)

				; Previous versions of Final Writer have the hyphenation
				; file, xxx.hyp, in FWFiles. With Final Writer Release 3
				; the hyphenation file will reside in FWSpell instead.
				; So, if we find the hyphenation file in FWFiles, then
				; move it to FWSpell.
				(if (exists (tackon FW_dest #old_hyph_file))
					(
						(if (exists (tackon FW_dest "FWSpell"))
							(
								(copyfiles
									(source (tackon FW_dest #old_hyph_file))
									(dest (tackon FW_dest "FWSpell"))
								)

								(delete (tackon FW_dest #old_hyph_file))
							)
						)
					)
				)
			)
		)

		(complete 4)

		; Installing FWLibs
		(if (IN install_options 3)
			(
				; If FWLibs doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWLibs")))
					(
					(makedir (tackon FW_dest "FWLibs"))
					)
				)

				; Make installer cd into FWLibs when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWLibs"))

				(working (#install_libs #install_disk_1))
				(set error
					(run
						("\"%s\" -f x \"Disk 1:FWLibs.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_libs_err)
				)

				(run ("Avail FLUSH"))
			)
		)

		(complete 8)

		; Installing FWFonts
		(if (IN install_options 4)
			(
				; If FWFonts doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFonts")))
					(
					(makedir (tackon FW_dest "FWFonts") (infos))
					)
				)

				; Make installer cd into FWFonts when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFonts"))

				(working (#install_sysfonts #install_disk_1))
				(set error
					(run
						("\"%s\" -f x \"Disk 1:FWFonts.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_sysfonts_err)
				)
			)
		)
	)
)

(complete 11)

; Installing Speller
(if (IN install_options 5)
	(
		; Get Disk 2
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_2))
			(help		(#ask_disk2_help #install_disk_2))
			(dest		#install_disk_2)
		)

		; Instaling FWSpell
		(if (IN install_options 5)
			(
				; If FWSpell doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWSpell")))
					(
					(makedir (tackon FW_dest "FWSpell"))
					)
				)

				; Preserve the user dictionary.
				(if (exists (tackon FW_dest (cat "FWSpell/" #ud_file)))
					(
						(set restore_UD 1)
						(copyfiles
							(source (tackon FW_dest (cat "FWSpell/" #ud_file)))
							(dest (tackon FW_dest "FWSpell"))
							(newname #save_ud_file)
						)
					)
					(set restore_UD 0)
				)

				; Make installer cd into FWSpell when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWSpell"))

				(working (#install_spell #install_disk_2))
				(set error
					(run
						("\"%s\" -f x \"Disk 2:FWSpell.lha\" >NIL:" DeArcher)
					)
				)

				(if restore_UD
					(
						(copyfiles
							(source (tackon FW_dest (cat "FWSpell/" #save_ud_file)))
							(dest (tackon FW_dest "FWSpell"))
							(newname #ud_file)
						)
						(delete (tackon FW_dest (cat "FWSpell/" #save_ud_file)))
					)
				)

				; Abort if any errors
				(if error
					(abort #install_spell_err)
				)

				; Previous versions of Final Writer have the hyphenation
				; file, xxx.hyp, in FWFiles. With Final Writer Release 3
				; the hyphenation file will reside in FWSpell instead.
				; So, if we find the hyphenation file in FWFiles, then
				; move it to FWSpell.
				(if (exists (tackon FW_dest #old_hyph_file))
					(
						(if (exists (tackon FW_dest "FWSpell"))
							(
								(copyfiles
									(source (tackon FW_dest #old_hyph_file))
									(dest (tackon FW_dest "FWSpell"))
								)

								(delete (tackon FW_dest #old_hyph_file))
							)
						)
					)
				)
			)
		)
	)
)

(complete 22)

(if (IN install_options 6 7)
	(
		; Get Disk 3
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_3))
			(help		(#ask_disk3_help #install_disk_3))
			(dest		#install_disk_3)
		)

		; Instaling FWThes
		(if (IN install_options 6)
			(
				; If FWThes doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWThes")))
					(
					(makedir (tackon FW_dest "FWThes"))
					)
				)

				; Make installer cd into FWThes when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWThes"))

				(working (#install_thes #install_disk_3))
				(set error
					(run
						("\"%s\" -f x \"Disk 3:FWThes.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_thes_err)
				)
			)
		)

		(complete 27)

		; Installing EPS Clip Art <cc> <fed> <maps> <metro1>
		(if (IN install_options 7)
			(
				; If FWClipArt doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWClipArt")))
					(
					(makedir (tackon FW_dest "FWClipArt"))
					)
				)

				; Make installer cd into FWClipArt when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWClipArt"))

				(working (#install_clipart #install_disk_3))

				(set error
					(run
						("\"%s\" -f x \"Disk 3:cc.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_clipart_err)
				)

				(complete 29)

				(set error
					(run
						("\"%s\" -f x \"Disk 3:fed.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_clipart_err)
				)

				(complete 30)

				(set error
					(run
						("\"%s\" -f x \"Disk 3:maps.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_clipart_err)
				)

				(complete 31)

				(set error
					(run
						("\"%s\" -f x \"Disk 3:metro1.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_clipart_err)
				)
			)
		)
	)
)

(complete 33)

(if (IN install_options 7)
	(
		; ----------
		; Get Disk 4
		;
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_4))
			(help		(#ask_disk4_help #install_disk_4))
			(dest		#install_disk_4)
		)

		; Installing EPS Clip Art <dms> <totem>

		; If FWClipArt doesn't exist, create it.
		(if (NOT (exists (tackon FW_dest "FWClipArt")))
			(
			(makedir (tackon FW_dest "FWClipArt"))
			)
		)

		; Make installer cd into FWClipArt when it executes the run statement
		(set @execute-dir (tackon FW_dest "FWClipArt"))

		(working (#install_clipart #install_disk_4))
		(set error
			(run
				("\"%s\" -f x \"Disk 4:dms.lha\" >NIL:" DeArcher)
			)
		)

		; Abort if any errors
		(if error
			(abort #install_clipart_err)
		)

		(complete 38)

		(set error
			(run
				("\"%s\" -f x \"Disk 4:totem.lha\" >NIL:" DeArcher)
			)
		)

		; Abort if any errors
		(if error
			(abort #install_clipart_err)
		)
	)
)

(complete 44)

(if (IN install_options 7 8)
	(
		; ----------
		; Get Disk 5
		;
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_5))
			(help		(#ask_disk5_help #install_disk_5))
			(dest		#install_disk_5)
		)

		; Instaling EPS Clip Art
		(if (IN install_options 7)
			(
				; Make installer cd into FWClipArt/Metro when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWClipArt/Metro"))

				(working (#install_clipart #install_disk_5))
				(set error
					(run
						("\"%s\" -f x \"Disk 5:Metro2.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_clipart_err)
				)
			)
		)

		(complete 48)

		; Instaling Decorative fonts
		(if (IN install_options 8)
			(
				; If FWFonts/SWOLFonts/Deco doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFonts/SWOLFonts/Deco")))
					(
					(makedir (tackon FW_dest "FWFonts/SWOLFonts/Deco") (infos))
					)
				)

				; Make installer cd into Deco when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFonts/SWOLFonts/Deco"))

				(working (#install_deco #install_disk_5))
				(set error
					(run
						("\"%s\" -f x \"Disk 5:Deco.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_deco_err)
				)
			)
		)

		(complete 51)

		; Instaling Serif1 fonts
		(if (IN install_options 8)
			(
				; If FWFonts/SWOLFonts/Serif doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFonts/SWOLFonts/Serif")))
					(
					(makedir (tackon FW_dest "FWFonts/SWOLFonts/Serif") (infos))
					)
				)

				; Make installer cd into Serif when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFonts/SWOLFonts/Serif"))

				(working (#install_serif #install_disk_5))
				(set error
					(run
						("\"%s\" -f x \"Disk 5:Serif1.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_serif_err)
				)
			)
		)
	)
)

(complete 55)

(if (IN install_options 8)
	(
		; ----------
		; Get Disk 6
		;
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_6))
			(help		(#ask_disk6_help #install_disk_6))
			(dest		#install_disk_6)
		)

		; Instaling Serif2 fonts
		(if (IN install_options 8)
			(
				; If FWFonts/SWOLFonts/Serif doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFonts/SWOLFonts/Serif")))
					(
					(makedir (tackon FW_dest "FWFonts/SWOLFonts/Serif") (infos))
					)
				)

				; Make installer cd into Serif when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFonts/SWOLFonts/Serif"))

				(working (#install_serif #install_disk_6))
				(set error
					(run
						("\"%s\" -f x \"Disk 6:Serif2.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_serif_err)
				)
			)
		)
	)
)

(complete 66)

(if (IN install_options 8)
	(
		; ----------
		; Get Disk 7
		;
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_7))
			(help		(#ask_disk7_help #install_disk_7))
			(dest		#install_disk_7)
		)

		; Instaling Sans serif fonts
		(if (IN install_options 8)
			(
				; If FWFonts/SWOLFonts/Sans doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFonts/SWOLFonts/Sans")))
					(
					(makedir (tackon FW_dest "FWFonts/SWOLFonts/Sans") (infos))
					)
				)

				; Make installer cd into Sans when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFonts/SWOLFonts/Sans"))

				(working (#install_sans #install_disk_7))
				(set error
					(run
						("\"%s\" -f x \"Disk 7:Sans.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_sans_err)
				)
			)
		)
	)
)

(complete 77)

(if (IN install_options 0 1 2 9)
	(
		; ----------
		; Get Disk 8
		;
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_8))
			(help		(#ask_disk8_help #install_disk_8))
			(dest		#install_disk_8)
		)

		; If installing/updating the program
		(if (IN install_options 0)
			(
				; Make installer cd into FW_dest when it executes the run statement
				(set @execute-dir FW_dest)

				; copy the Final Writer program over if the program
				; icon doesn't exists copy it over too.
				( if (exists (tackon FW_dest "FinalWriter.info"))
					; This DOES NOT copy the icon, in case the user
					; has modified the tool-types
					(
						(working (#install_program #install_disk_8))
						(set error
							(run
								("\"%s\" -f x \"Disk 8:FinalWriter.lha\" FinalWriter >NIL:" DeArcher)
							)
						)
					)
					; This DOES copy the icon
					(
						(working (#install_program_icon #install_disk_8))
						(set error
							(run
								("\"%s\" -f x \"Disk 8:FinalWriter.lha\" >NIL:" DeArcher)
							)
						)
					)
				)
			)
		)

		(if error
			(abort #install_program)
		)

		(complete 82)

		; Installing FWMacros
		(if (IN install_options 1)
			(
				; If FWMacros doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWMacros")))
					(
					(makedir (tackon FW_dest "FWMacros") (infos))
					)
				)

				; Make installer cd into FWMacros when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWMacros"))

				; Extract the macro files
				(working (#install_macros #install_disk_8))
				(set error
					(run
						("\"%s\" -f x \"Disk 8:FWMacros.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_macros_err)
				)
			)
		)

		(complete 84)

		; Installing Templates
		(if (IN install_options 9)
			(
				; If FWTemplates doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWTemplates")))
					(
					(makedir (tackon FW_dest "FWTemplates") (infos))
					)
				)

				; Make installer cd into FWTemplates when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWTemplates"))

				; Extract the files
				(working (#install_temps #install_disk_8))
				(set error
					(run
						("\"%s\" -f x \"Disk 8:FWTemplates.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_temps_err)
				)
			)
		)

		(complete 86)

		; Installing grammar part 1 into FWFiles
		(if (IN install_options 2)
			(
				; If FWFiles doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFiles")))
					(
					(makedir (tackon FW_dest "FWFiles") (infos))
					)
				)

				; Make installer cd into FWFiles when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFiles"))

				; Extract the files
				(working (#install_grammar #install_disk_8))
				(set error
					(run
						("\"%s\" -f x \"Disk 8:FWGram1.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_gram_part1_err)
				)
			)
		)
	)
)

(complete 88)

(if (IN install_options 2)
	(
		; ----------
		; Get Disk 9
		;
		(askdisk
			(prompt	(#ask_disk_prompt #install_disk_9))
			(help		(#ask_disk9_help #install_disk_9))
			(dest		#install_disk_9)
		)

		; Installing grammar part 2 into FWFiles
		(if (IN install_options 2)
			(
				; If FWFiles doesn't exist, create it.
				(if (NOT (exists (tackon FW_dest "FWFiles")))
					(
					(makedir (tackon FW_dest "FWFiles") (infos))
					)
				)

				; Remove old grammar file
				(if (exists (tackon FW_dest (cat "FWFiles/" #oldgram_file)))
					(delete (tackon FW_dest (cat "FWFiles/" #oldgram_file)))
				)

				; Make installer cd into FWFiles when it executes the run statement
				(set @execute-dir (tackon FW_dest "FWFiles"))

				; Extract the files
				(working (#install_grammar #install_disk_9))
				(set error
					(run
						("\"%s\" -f x \"Disk 9:FWGram2.lha\" >NIL:" DeArcher)
					)
				)

				; Abort if any errors
				(if error
					(abort #install_gram_part2_err)
				)

				; Join the two grammar data files.
				(working #combine_grammar)
				(set error
					(run
						("Join gram.part1 gram.part2 TO %s" #gram_file)
					)
				)

				; Abort if any errors
				(if error
					(abort #combine_grammar_err)
				)

				; Delete part 1 and part 2 files.
				(delete (tackon FW_dest "FWFiles/gram.part1"))
				(delete (tackon FW_dest "FWFiles/gram.part2"))
			)
		)
	)
)

(complete 99)

; If FWDocs doesn't exist, create it.
(if (NOT (exists (tackon FW_dest "FWDocs")))
	(
	(makedir (tackon FW_dest "FWDocs") (infos))
	)
)

; If FWTextClips doesn't exist, create it.
(if (NOT (exists (tackon FW_dest "FWTextClips")))
	(
	(makedir (tackon FW_dest "FWTextClips") (infos))
	)
)

(delete DeArcher)

(complete 100)

(exit)

