;PAGESTREAM 3.0h2 ONLINE UPDATE PATCH INSTALLATION SCRIPT
;COPYRIGHT ©1995 SOFT-LOGIK PUBLISHING CORPORATION

;QUIT PROGRAMS
(message "\n\nIf PageStream3, BME2 or PageLiner are running now, quit them before continuing.")
(run "avail flush" (safe))

;USE ASSIGNS TO AVOID THE STUPID INSTALLER'S CRASH BUG
(run "CD PageStream3:" (safe))
(run "CD SoftLogik:" (safe))
(run "assign fonts: softlogik:fonts add" (safe))

;TEST TO SEE IF THEY HAVE PGS3H22.LHA
(if (<> (exists "PGSpatch.LHA") 1)
	(abort "You did not download the PGS3H22D.LHA archive. Download it and decompress it to the same directory as you decompressed this archive before continuing.")
)

;GET DESTINATION
(set PGSdest (getassign "PageStream3" "a"))
(set SLdest (getassign "SoftLogik" "a"))
(if (OR (= PGSdest "") (= SLdest ""))
	(abort "PageStream3: and/or SoftLogik: are not assigned. You must properly install PageStream3 before applying this update patch.")
)
(set @default-dest PGSdest)

;MAKE REQUIRED DIRECTORIES IF THEY DON'T EXIST
(if (<> (exists "PageStream3:PageStream3") 1)
	(abort "PageStream3 is not in the PageStream3: directory. You must properly install PageStream3 before applying this update patch.")
)
(if (<> (exists "SoftLogik:Engines") 2) (makedir "SoftLogik:Engines" (infos)))
(if (<> (exists "SoftLogik:Libs") 2) (makedir "SoftLogik:Libs" (infos)))
(if (<> (exists "SoftLogik:Printers") 2) (makedir "SoftLogik:Printers" (infos)))
(if (<> (exists "SoftLogik:Filters") 2) (makedir "SoftLogik:Filters" (infos)))
(if (<> (exists "SoftLogik:Effects") 2) (makedir "SoftLogik:Effects" (infos)))
(if (<> (exists "PageStream3:Help") 2) (makedir "PageStream3:Help" (infos)))
(if (<> (exists "PageStream3:Macros") 2) (makedir "PageStream3:Macros" (infos)))
(if (<> (exists "PageStream3:Macros/TextClips") 2) (makedir "PageStream3:Macros/TextClips" (infos)))
(if (<> (exists "PageStream3:Documents") 2) (makedir "PageStream3:Documents" (infos)))

;COPY THE LHEX PROGRAM TO RAM:
(copyfiles (source "PageStream3Disk1:lhex") (dest "ram:") (nogauge))

;SEE WHAT THE USER WANTS TO INSTALL
(set ALLflag 0)
(set SMAflag 1)

(message ("\n\nThis patch will update your German PageStream3.0h hard drive installation to version 3.0h2.\n\nYour original PageStream3 disks will not be modified by this update.\n\nYou MUST have 3.0h installed to use this patch."))
(set install_mode
	(askchoice
		(prompt
			"\nSelect an installation option.\n\nChoose `ALL' if you have a full PageStream3 installation. Choose `ONLY' if you have a custom or minimum PageStream3 installation.\n")
		(choices "Install ALL improved files" "Update ONLY the currently installed files")
		(default 0)
		(help
			"\n\nThe ONLY option will check to see if a file exists before copying the new one to your hard drive. Thus, if you deleted the HP.printer driver because you didn't need it, the new one will not be installed.")
	)
)


;UPDATE LIBS
(working "Installing Updated Libraries...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Libs x Libs.lha")
(delete "Libs.LHA" (safe))

;UPDATE PRINTER DRIVERS
(working "Installing Updated Printer Drivers...")
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/PostScript.printer"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PrinterPS.LHA")
)
(delete "PrinterPS.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/HP.printer"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PrinterHP.LHA")
)
(delete "PrinterHP.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/Epson.printer"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PrinterEP.LHA")
)
(delete "PrinterEP.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/IFFILBM.printer"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PrinterIF.LHA")
)
(delete "PrinterIF.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/Preference.printer"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PrinterPR.LHA")
)
(delete "PrinterPR.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/Fargo.printer"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PrinterFA.LHA")
)
(delete "PrinterFA.LHA" (safe))

;UPDATE ENGINES
(working "Installing Updated Engines...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Engines x Engines.lha")
(delete "Engines.LHA" (safe))

;UPDATE FILTERS
(working "Installing Updated Filters...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Filters.lha")
(delete "Filters.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/Wordworth.tfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x FilterWW.lha")
)
(delete "FilterWW.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/ArtExpression.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x FilterAE.lha")
)
(delete "FilterAE.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/ProPage.dfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x FilterPP.lha")
)
(delete "FilterPP.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/PCX.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x FilterPC.lha")
)
(delete "FilterPC.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/TIFF.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x FilterTI.lha")
)
(delete "FilterTI.LHA" (safe))

;UPDATE MACROS
(if (exists "PageStream3:Macros/PageStream3.macros.bak")
	(delete "PageStream3:Macros/PageStream3.macros.bak")
)
(if (exists "PageStream3:Macros/PageStream3.macros")
	(rename "PageStream3:Macros/PageStream3.macros" "PageStream3:Macros/PageStream3.macros.bak")
)
(working "Installing Updated Macros...")
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3:Macros x Macros.lha")
(delete "Macros.LHA" (safe))
(if (exists "PageStream3:Macros/PageStream3.macros.bak")
	(message "\nYour PageStream3.macros file has been renamed to PageStream3.macros.bak and you now have the English macro files. If you have added your own macros to PageStream3, you will need to append them to the new macros file.\n\nRefer to page 339 for more information.")
)


;UPDATE PAGELINER2
(if (exists "PageStream3:PageLiner")
	(
		(working "Patching PageLiner to 2.0f...")
		(run "ram:lhex >NIL: <NIL: -qfw=ram: x PLpatch.LHA")
		(run "spatch >NIL: <NIL: -oPageStream3:PageLiner2.0f -pram:PageLiner.pch PageStream3:PageLiner")
		(if (exists "PageStream3:PageLiner2.0f")
			(
				(delete "PageStream3:PageLiner")
				(rename "PageStream3:PageLiner2.0f" "PageStream3:PageLiner")
			)
			(message "\nThe patch to PageLiner was not successful. Refer to the Read.1st! file for further instructions.")
		)
		(delete "ram:PageLiner.pch" (safe))
	)
)
(delete "PLpatch.LHA" (safe))

;UPDATE BME2
(if (exists "PageStream3:BME")
	(
		(working "Patching BME to 2.0d...")
		(run "ram:lhex >NIL: <NIL: -qfw=ram: x BMEpatch.LHA")
		(run "spatch >NIL: <NIL: -oPageStream3:BME2.0d -pram:BME.pch PageStream3:BME")
		(if (exists "PageStream3:BME2.0d")
			(
				(delete "PageStream3:BME")
				(rename "PageStream3:BME2.0d" "PageStream3:BME")
			)
			(message "\nThe patch to BME was not successful. Refer to the Read.1st! file for further instructions.")
		)
		(delete "ram:BME.pch" (safe))
	)
)
(delete "BMEpatch.LHA" (safe))

;UPDATE PAGESTREAM3
(working "Patching PageStream to 3.0h2...\n\nThis will take from one to five minutes.")
(run "ram:lhex >NIL: <NIL: -qfw=ram: x PGSpatch.LHA")
(delete "PGSpatch.LHA" (safe))
(run "spatch >NIL: <NIL: -oPageStream3:PageStream3.0h2 -pram:PageStream.pch PageStream3:PageStream3")
(if (exists "PageStream3:PageStream3.0h2")
		(
				(delete "PageStream3:PageStream3")
				(rename "PageStream3:PageStream3.0h2" "PageStream3:PageStream3")
		)
		(abort "The patch to PageStream3 was not successful. Refer to the Read.1st! file for instructions.")
)
(delete "ram:PageStream.pch" (safe))

;PATCH EXTRAS TO LATEST VERSION IF APPLICABLE

(run "ram:lhex >NIL: <NIL: -qfw=ram: x XTpatch.LHA")
(set TTsize (getsize "SoftLogik:Engines/TTF.font"))
(set WWsize (getsize "SoftLogik:Filters/Wordworth.dfilter"))
(if (= TTsize 36704)
	(
		(working "Updating TrueType font engine to the latest version...")
		(run "ram:spatch -oram:TTF.font -pram:TTF.pch SoftLogik:Engines/TTF.font")
		(set TTsize (getsize "ram:TTF.font"))
		(if (= TTsize 37176)
			(copyfiles (source "ram:TTF.font") (dest "SoftLogik:Engines"))
			(message "Could not update TrueType font engine.\n\nEmail technical support at tech@slpc.com for installation assistance.")
		)
	)
)
(if (= WWsize 33256)
	(
		(working "Updating Wordworth Document Filter to the latest version...")
		(run "ram:spatch -oram:Wordworth.dfilter -pram:Wordworth.pch SoftLogik:Filters/Wordworth.dfilter")
		(set WWsize (getsize "ram:Wordworth.dfilter"))
		(if (= WWsize 34760)
			(copyfiles (source "ram:Wordworth.dfilter") (dest "SoftLogik:Filters"))
			(message "Could not update Wordworth document filter.\n\nContact Soft-Logik for installation assistance.")
		)
	)
)
(delete "XTpatch.LHA" (safe))
(delete "ram:TTF.pch" (safe))
(delete "ram:TTF.font" (safe))
(delete "ram:Wordworth.pch" (safe))
(delete "ram:Wordworth.dfilter" (safe))

;INSTALL SAMPLE TEXTFX DOC
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3:Documents x TextFXdoc.LHA")
(delete "TextFXdoc.LHA" (safe))

;DISPLAY README (Try 3 different ways!)
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3: x Read.LHA")
(delete "Read.LHA" (safe))
(IF (> (run "Sys:Utilities/MultiView PageStream3:ReadMe.Now") 0)
		(IF (> (run "Sys:Utilities/AmigaGuide PageStream3:ReadMe.Now") 0)
				(run "More PageStream3:ReadMe.Now")
		)
)

;REMOVE THE LHEX PROGRAM
(delete "ram:lhex" (safe))
(delete "spatch" (safe))
(delete "Install-PageStream3.0h2.info" (safe))

(message "NEW!\n\nThe new TextFX extension for PageStream3 allows you to warp text in shapes and bend it on curves! Now available separately for $50. ($40 for owners of Art Expression.)\n\nCall 1-800-829-8608 (314-256-9595) to order!")

;FINALLY DONE
(exit "PageStream 3.0h2 installed!")
