When the emulator starts up, the script will launch the application you specify in the script. When you close the application, the emulator will shut down. The first time you run it, but only the first time, it will ask you where the application is located.
To create this script, copy the code below into the AppleScript editor (you may need to install it separately) inside the SheepShaver/Basilisk II system. When saving, set Kind to Application; add checkmarks next to "Stay Open" and "Never Show Startup Screen."
Test it by launching it OUTSIDE the Startup Items folder before actually putting it in the Startup Items folder.
This works in System 7.55 or later. I know there are more efficient ways of writing it, but the more efficient ways don't seem to work in ancient Macs. (For example, "delay" doesn't exist in system 7.5.5, so I used a kludge workaround instead.)
One important thing: Make absolutely certain that the application name specified in two parts of the script is exactly the same as the name of the application itself. If the two names don't match, then the script will simply shutdown SheepShaver or Basilisk II after a few seconds.
I've tried using a variable for the application name, but that doesn't seem to work, at least not on 7.55.
Code: Select all
global appRunning
global cycles
on run
tell application "APPLICATION NAME HERE" to activate
set cycles to 1
end run
on idle
tell application "Finder"
tell application "Finder" to name of processes
if the result contains "APPLICATION NAME HERE" then
set appRunning to true
else
set appRunning to false
end if
end tell
if appRunning is false then
if cycles is greater than 1 then
-- tell me to quit -- use this for testing to avoid shutdown
tell application "Finder" to shut down
end if
end if
set cycles to cycles + 1
return 5 -- number of seconds between tests for application running
end idle