Last active
August 3, 2024 09:59
-
-
Save edenwaith/ecb3430039758e11b04b458edb10319a to your computer and use it in GitHub Desktop.
AppleScript to install Quest For Glory V on Mac OS 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- QFG5 Mac OS 9 Installer | |
-- Author: Chad Armstrong ([email protected]) | |
-- Version History: | |
-- • Version 1.1 (April - May 2022) | |
-- • Version 1.0 (8 October 2001) | |
tell application "Finder" | |
set startupDisk to (name of startup disk) | |
set applicationsFolder to startupDisk & ":Applications:" | |
set macOS9ApplicationsFolder to startupDisk & ":Applications (Mac OS 9):" | |
set destinationFolder to folder startupDisk | |
-- Find an appropriate destination folder location | |
if exists folder macOS9ApplicationsFolder then | |
set destinationFolder to folder macOS9ApplicationsFolder | |
else if exists folder applicationsFolder then | |
set destinationFolder to folder applicationsFolder | |
end if | |
-- Check for the installation disc before proceeding | |
if exists disk "QG5 Install" then | |
set sourceQFG5Disk to disk "QG5 Install" | |
set qfgFolderName to "Quest For Glory V" | |
-- Create and set the main destination folder | |
if not (exists folder qfgFolderName of destinationFolder) then | |
make new folder at destinationFolder with properties {name:qfgFolderName} | |
end if | |
set destQFG5Folder to folder qfgFolderName of destinationFolder | |
-- Create and set the Data destination folder | |
if not (exists folder "Data" of destQFG5Folder) then | |
make new folder at destQFG5Folder with properties {name:"Data"} | |
end if | |
set destDataFolder to folder "Data" of destQFG5Folder | |
set sourceInstallFolder to folder "Install" of sourceQFG5Disk | |
set sourceDataFolder to folder "Data" of sourceInstallFolder | |
-- Set a timeout of 10 minutes to avoid Applescript thinking this has timed out | |
with timeout of 600 seconds | |
-- Copy the folders MDATA, Import, and the file QFG5 | |
select {folder "MDATA" of sourceInstallFolder, file "QFG5" of sourceInstallFolder, folder "Imports" of sourceInstallFolder} | |
copy selection to folder qfgFolderName of destinationFolder | |
-- Copy the files hdn.spk, hdnm.spk, and the folder Mov | |
select {file "hdn.spk" of sourceDataFolder, file "hdnm.spk" of sourceDataFolder, folder "Mov" of sourceDataFolder} | |
copy selection to folder "Data" of destQFG5Folder | |
end timeout | |
open destQFG5Folder | |
else | |
display dialog "Insert the disk \"QG5 Install\" to install Quest for Glory V." buttons {"OK"} with icon caution | |
end if | |
end tell |
For Version 1.1:
- The script was entirely rewritten.
- Check if the QFG5 Install disc is present before proceeding.
- Check for existing folders before creating them.
- Check for multiple suitable installation locations.
- Extend the timeout period so AppleScript doesn't throw an error while copying the files.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Areas to improve: