Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jdr999

macrumors newbie
Original poster
Feb 27, 2007
15
0
NJ
Please excuse this quick rant.

:rant
I thought Mac's were the preferred computer for educational software and schools. After having my new iMac 24 for a few weeks I'm not so sure about that anymore. Many educational games cannot change the screen resolution and run in a tiny 640x480 box in the center of my iMac. Almost all require the CD to be inserted. Many have slow, choppy video where the lip movements aren't even close to in sync with the audio. And I won't even open the whole OS X/Classic/Intel can of worms that many titles bring to the table! Oh wait, I did :(

My wife thinks I'm crazy for replacing her PC with a Mac and running all of our newly purchased kid software in Parallels due to the screen resolution / Classic / Intel problems! :confused:
:end rant

What I need to do have an Applescript to do the following: Mount a disk image I made in Toast, change the screen resolution and run the game. Then when the game exits eject the image and reset the desktop screen resolution.

I'm close but not there yet. Sometimes it works, and sometimes I get a Stack Overflow when I exit. I think my problem may be the:

Code:
on idle
     if
     else
         idle
     end if
end idle
But without the "else idle" the game exit isn't detected and the cleanup never runs.

---------------------------------------------------------

Here is my Script:

Code:
on idle
	tell application "System Events"
		set myProcesses to (name of every process)
	end tell
	if "MiaOSX" is not in myProcesses then
		do shell script "cscreen -x 1920 -y 1200 -r 60"
		tell application "Finder" to eject "Mia2_D1"
		tell application "Finder" to eject "Mia2_D2"
		tell me to quit
	else
		idle
	end if
end idle

on run
	do shell script "cscreen -x 640 -y 480 -r 60"
	set myPath to ("Macintosh HD:Users:Shared:Disk Images:")
	do shell script ("hdiutil mount \"" & POSIX path of (myPath as string) & "Mia's Romaine's New Hat (Science) Disk 1.iso\"")
	do shell script ("hdiutil mount \"" & POSIX path of (myPath as string) & "Mia's Romaine's New Hat (Science) Disk 2.iso\"")
	set myApp to myPath & "MiaScience"
	tell application myApp to activate
	delay 5
	idle
end run
-------------------------------------

Anyone have any ideas how to improve this?

Thanks!
 
Just a quick follow up in case anyone is interested. I did manage to fix it. The trick was to do a Save As Application with the "Stay Open" box checked. Then it did what it was supposed to. Here's the new code:

Code:
on idle
	tell application "System Events" to set myProcesses to (name of every process)
	if "MiaOSX" is not in myProcesses then
		do shell script "cscreen -x 1920 -y 1200 -r 60"
		tell application "Finder"
			if exists (disk "Mia2_D1") then eject "Mia2_D1"
			if exists (disk "Mia2_D2") then eject "Mia2_D2"
		end tell
		tell me to quit
	end if
	return 2
end idle

on run
	do shell script "cscreen -x 640 -y 480 -r 60"
	set myPath to ("Macintosh HD:Users:Shared:Disk Images:")
	do shell script ("hdiutil mount \"" & POSIX path of (myPath as string) & "Mia's Romaine's New Hat (Science) Disk 1.iso\"")
	do shell script ("hdiutil mount \"" & POSIX path of (myPath as string) & "Mia's Romaine's New Hat (Science) Disk 2.iso\"")
	set myApp to myPath & "MiaScience"
	tell application myApp to activate
	idle
end run
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.