Our kids got a refurbished iMac for Christmas. I also got them Didi & Ditto and a Reader Rabbit game. Both of these games require the CD to be mounted for them to be played.
I didn't want to have to deal with CDs, as it always seems that CDs that the kids have access to end up getting scratched. So I created disk images from each of these CDs, and put them in a place where all users can have access to. Then I wanted to make sure that when the applications are launched the disk images were mounted.
Here is the AppleScript that I use to make sure that use to launch the program. The majority of this script came from this hint at macosxhints.
property diskpath : "Macintosh HD:Users:Shared:Didi & Ditto.dmg"
property appLocation : "Macintosh HD:Applications:Didi & Ditto.app"
on run
tell application "Finder"
if not (exists the disk diskname) then
do shell script ("hdiutil attach " & quoted form of POSIX path of (diskpath as string) & " -mount required")
repeat until name of every disk contains diskname
delay 1
end repeat
end if
open item appLocation
end tell
delay 5
end run
It automatically will mount the disk image, if it is not mounted already, and then it will launch the program
Technorati Tags: AppleScript
No comments:
Post a Comment