Twenty-one years ago I created an AppleScript to serve as an installer for Quest for Glory V on Mac OS 9. This was created because the original installer did not work under Mac OS 9 (but oddly enough, the installer that comes with the German version ("Drachenfeuer") of the game worked fine). This script was based off of advice I got from QFG5's lead programmer Eric Lengyel on which particular files need to be copied off of the install CD.
AppleScript is always kind of interesting to play with. Some things are quite elegant, whereas other things can be quite maddening in their implementation. The original script was far from a piece of beautiful coding prose, since it was likely produced by recording my actions using Script Editor. This updated version (1.1) of the script is a complete rewrite with several improvements and safe guards.
- Checks for an appropriate destination: It first checks if the
Applications (Mac OS 9)folder exists. If not, then it looks for the
Applicationsfolder. If neither of those options exists, then the game is installed on the startup disk.
- First checks if any of the destination folders already exist before trying to create them.
- Checks to see if the
QG5 InstallCD is inserted. If not, the installation shows a warning and will not progress.
- Extends the timeout period to complete the script when copying the files so AppleScript does not give an errant error.
The installer script can be downloaded here.
The list of files which are copied over:
- From the QG5 Install/Install folder, copy the folders MDATA, Import, and the file QFG5 to the Quest for Glory V destination folder
- From the QG5 Install/Install/Data folder, copy the files hdn.spk, hdnm.spk, and the folder Mov to the Quest for Glory V/Data destination folder
One feature I wanted to implement with this script was to be able to copy the QFG5 icon onto the main destination folder, but I have not found a way to do this in Mac OS 9. There is a way to do this in Mac OS X which requires "System Events", but unfortunately that is not available on Mac OS 9, so the function below won't work for this script. The following is an example code snippet that can copy the icon of a file and paste it onto a folder.
tell application "Finder" set sourcePath to file "Snow Leopard:Users:chad:Pictures:L-150.tif" set destPath to folder "Snow Leopard:Users:chad:Desktop:Foo:" my CopyOrPaste(sourcePath, "c") my CopyOrPaste(destPath, "v") end tell on CopyOrPaste(i, cv) tell application "Finder" activate open information window of i end tell tell application "System Events" to tell process "Finder" to tell window 1 delay 0.25 keystroke tab -- select icon button delay 0.25 keystroke (cv & "w") using command down (* (copy or paste) + close window *) end tell end CopyOrPaste
It's been five years since I've played Quest for Glory V, and this is the first of several QFGV-related projects I'm planning for this year. There's also a fan-made patch for the game to try out, in addition to setting up my ideal PowerMac system when I replay the game this year.