anyone good with applescript?

Soldato
Joined
19 Oct 2002
Posts
3,480
Hi guys,

been trying to get my head around applescript and as an exercise i'm trying to make a loader for diablo II (which will also work for warcraft 3 and starcraft and anything else which requires a cd image to be mounted prior to running the game)

so far i have this:

Code:
property gameRunning : false
property gameMounted : false
property gameName : "Diablo II (Carbon)"
property gameImageName : "Lord of Destruction"

set gameImage to (path to library folder from user domain as text) & "Installation Files & Disc Images:Games:Diablo II:Diablo II - Lord Of Destruction.iso"
do shell script "hdiutil attach " & quoted form of POSIX path of gameImage
activate application gameName

on idle
	tell application "System Events"
		set gameRunning to gameName is in (get name of processes)
		set gameMounted to gameImageName is in (get name of disks)
	end tell
	if gameRunning is false and gameMounted then quit
	return 60
end idle

on quit
	do shell script "hdiutil detach " & quoted form of ("/Volumes/" & gameImageName)
	continue quit
end quit

and this does actually work, but only 10% of the time...

when it works, the image mounts, the game runs, and when the game is exited, the disc unmounts and the script app closes...

however, when it doesnt work (which like i said is the majority of the time) the script loads, hdiutil loads (activity viewer) and maxes out the cores and it remains like that until i force quit it...

so i'm assuming there is something unorthodox about the way the image is getting mounted... any advice on why this happens or general applescript hints and tips related to this would be much appreciated :)
 
i had also found that mate, and was one of the things i tried before i tried to construct my own...

the problem still exists in this version (maybe a leopard thing?), so the question still remains, is there something in my code (or this new code for that matter), that could be maxing out hdiutil?
 
Back
Top Bottom