;;
;;  $British English (UK) Language Installation Script $
;;  $Date: 1994/11/02 11:18:46 $
;;  $Revision: 1.1 $
;;

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

; Disk Names
(set #ld_disk1 "LD1_BRT")
(set #ld_disk2 "LD2_BRT")

; Hyphenation file
(set #hyphen_file
(cat	#ld_disk1
		":brt.hyp"
))

; LHex file
(set #lhex_program
(cat	#ld_disk1
		":lhex"
))

; Archived Speller file
(set #spell_lha_file
(cat	#ld_disk1
		":FWSpell.lha"
))

; Archived Thesaurus file
(set #thes_lha_file
(cat	#ld_disk2
		":FWThes.lha"
))


; ---------------------------------------------------------------
; TRANSLATION SHOULD BEGIN HERE - Translate everything in quotes.

(set #which_drawer
(cat	"Please select your Final Writer drawer."
))

(set #which_drawer_help
(cat	"    Please select your Final Writer drawer, for example, \"Work:FinalWriter\". "
		"This installation utility will install the British English (UK) language files "
		"into the proper locations within this Final Writer drawer. Please "
		"note that you must be using Final Writer Release 3 to be able to "
		"use these additional language files.\n\n"
))

(set #ask_ld_disk
(cat	"\n\nPlease insert \"%s\" in any drive."
))

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

(set #ask_disk2_help
(cat	"    \"%s\" contains the thesaurus files that are to be installed.\n\n"
		@askdisk-help
))

(set #working_msg_spell
(cat	"Installing Speller files from \"%s\"."
))

(set #working_msg_thes
(cat	"Installing Thesaurus files from \"%s\"."
))

(set #err_wrong_drawer
(cat	"Cannot install the language files in this drawer. The drawer "
		"you have chosen does not appear to be a Final Writer drawer."
))

(set #more_wrong_drawer_help
(cat	"    Choose the Proceed button to select another drawer or "
		"choose the Abort Install button to quit the installation."
))

(set #err_speller
(cat	"Error installing Speller Files."
))

(set #err_thesaurus
(cat	"Error installing Thesaurus Files."
))

; TRANSLATION SHOULD END HERE - nothing below needs translation.
; --------------------------------------------------------------

(set is_ok 0)

(while (= is_ok 0)

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

	; Check if FW_dest is really the FinalWriter drawer or
	; if it is the drawer that the FinalWriter drawer is in.
	(if (exists (tackon FW_dest "FWSpell"))
		(set is_ok 1)
		(	(if (exists (tackon FW_dest "FinalWriter/FWSpell"))
				(	(set is_ok 1)
					(set FW_dest (tackon FW_dest "FinalWriter"))
				)
				(	(if (exists (tackon FW_dest "FinalWriter_B/FWSpell"))
						(	(set is_ok 1)
							(set FW_dest (tackon FW_dest "FinalWriter_B"))
						)
						(	(if (exists (tackon FW_dest "FinalWriter_D/FWSpell"))
								(	(set is_ok 1)
									(set FW_dest (tackon FW_dest "FinalWriter_D"))
								)
								(	(if (exists (tackon FW_dest "FinalWriter_N/FWSpell"))
										(	(set is_ok 1)
											(set FW_dest (tackon FW_dest "FinalWriter_N"))
										)
									)
								)
							)
						)
					)
				)
			)
		)
	)

	(if (= is_ok 0)
		(message #err_wrong_drawer
			(help #which_drawer_help #more_wrong_drawer_help)
		)
		(set @default-dest FW_dest)
	)

)

; -------------------------------------------------
; Install Hyphenation and Speller Files from Disk 1
; -------------------------------------------------

; Ask for Disk 1
(askdisk
	(prompt	(#ask_ld_disk #ld_disk1))
	(help		(#ask_disk1_help #ld_disk1))
	(dest 	#ld_disk1)
)

; Copy the extraction utility over and remember where it is
(copyfiles
	(source #lhex_program)
	(dest FW_dest)
)

(set DeArcher (tackon FW_dest "lhex"))
(set error 0)

; Copy hypenation file to FWSpell.
(copyfiles
	(source #hyphen_file)
	(dest (tackon FW_dest "FWSpell"))
)

(complete 10)

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

; Dearc FWSpell.lha
(working (#working_msg_spell #ld_disk1))
(set error
	(run
		("\"%s\" -f x %s >NIL:" DeArcher #spell_lha_file)
	)
)

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

(complete 50)

; -----------------------------------
; Install Thesaurus Files from Disk 2
; -----------------------------------

; Ask for Disk 2
(askdisk
	(prompt	(#ask_ld_disk #ld_disk2))
	(help		(#ask_disk2_help #ld_disk2))
	(dest 	#ld_disk2)
)

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

; Dearc FWThes.lha
(working (#working_msg_thes #ld_disk2))
(set error
	(run
		("\"%s\" -f x %s >NIL:" DeArcher #thes_lha_file)
	)
)

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

(delete DeArcher)

(complete 100)

(exit)

