Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'An AppleScript to mount, run, unmount a disk image' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to mount, run, unmount a disk image
Authored by: Dale Mox on Sep 07, '04 11:25:22AM
hehe, *proud* (of the very little I did to make to whole thing function)
By the way, is the
do shell script ("hdiutil unmount /Volumes/" & diskname & " -force")
necessay? I would think a simple
do shell script ("hdiutil detach " & devname)
with or without the -force, should be able to unmount and detach the whole disk.
However, I stand by 'If it ain't broke, don't fix it" (unless it hogs the CPU while functioning)
Dale Mox

[ Reply to This | # ]
An AppleScript to mount, run, unmount a disk image
Authored by: emendelson on Sep 07, '04 02:13:06PM

What Dale says (and thanks again, Dale!) *should* be right, but OS X seems to have some obscure bugs that prevent it from doing the right thing every time it should.

If I remove the line that Dale mentioned, the script works two or three time - but then, the next time, it launches the application, and the application complains that the disk image is not available - even though it's right there on the desktop. And then the script won't work again (I mean the application won't see the disk image again) until a reboot.

When I include the unmount AND the detach lines, the script continues to work correctly even when I run it ten times - which is the most I've tried so far.

As Dale says, the script is a bit of a CPU hog when it's unmounting and detaching, but this is probably better than waiting through the reboot that seems to be required after it fails. But maybe future versions of OS X won't require all this extra work...

[ Reply to This | # ]