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

;SEE IF PAGESTREAM3 AND SOFTLOGIK ARE ASSIGNED AND EVERYTHING EXISTS
(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)
(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:Libs") 2)
	(makedir "SoftLogik:Libs" (infos))
)
(if (<> (exists "SoftLogik:Engines") 2)
	(makedir "SoftLogik:Engines" (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 "SoftLogik:Special") 2)
	(makedir "SoftLogik:Special" (infos))
)
(if (<> (exists "PageStream3:Help") 2)
	(makedir "PageStream3:Help" (infos))
)
(if (<> (exists "PageStream3:Macros") 2)
	(makedir "PageStream3:Macros" (infos))
)

;CHECK VERSIONS INSTALLED
(working "Checking version of current PageStream3...")
(makedir "env:PageStream3")
(run "version PageStream3:PageStream3 full >env:PageStream3/temp")
(set PGSver (substr (getenv "PageStream3/temp") 13 3))
(if (= PGSver "d v")
	(abort "There is insufficient memory to install this patch. Refer to the Read.1st! file for instructions.")
)

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

;DO THEY HAVE 3.0e?
(if (<> PGSver ".0e")
	(abort "You have downloaded the 3.0e to 3.0f patch, but you do not have 3.0e installed on your system!")
)

;UPDATE PAGESTREAM3
(working "Decompressing PageStream3.0f patch...")
(run "ram:lhex >NIL: <NIL: -qfw=ram: x PGSpatch.LHA")
(delete "PGSpatch.LHA" (safe))
(working "Patching PageStream to 3.0f...\n\nThis will take about one minute.")
(run "spatch >NIL: <NIL: -oPageStream3:PageStream3.0f -pram:PageStream3.pch PageStream3:PageStream3")
(if (exists "PageStream3:PageStream3.0f")
	(
		(delete "PageStream3:PageStream3")
		(rename "PageStream3:PageStream3.0f" "PageStream3:PageStream3")
	)
	(abort "Patch was not successful. Cause was probably lack of RAM, a bad disk, or an incorrect version of PageStream3. Refer to the Read.1st! file for instructions.")
)
(delete "ram:PageStream3.pch" (safe))

;QUICKIE README
(message "\n\nCHANGES IN VERSION 3.0f\n\nThis update fixes the load/save crash problem with 3.0e; documents containing groups or drawings could not be loaded or saved.\n\nThe only other difference with this version is that you can double click with the Text tool to select a word, and triple click to select a paragraph.")

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

;GEE, THAT WAS FUN
(exit "PageStream 3.0f installed!")
