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


Click here to return to the 'AppleScript to Force-mount unmountable disk images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
AppleScript to Force-mount unmountable disk images
Authored by: Frederico on Sep 16, '04 06:03:29AM
Man, it is amazing how fast folks around here report bugs. Sorry for the oversights; the script was originally written for single DMGs, and I added multiples without really testing it or thinking it through; also we rarely use a special character in a file path because we're so used to working on the web. All bugs should be resolved, except those idiosyncracies that exist with name problems in hdiutil (such as "image already specified" errors).

set theDMGs to (choose file with prompt 
	"Where is the .DMG file or files you wish to mount?" of type {"devi", "devr"} 
	with multiple selections allowed) as list
set {a, b, c} to {"Cancel", "Verify", "Skip Verification"}
set msg1 to "Would you like to skip verification? (recommended)" & return & return
set msg2 to "CAUTION: verification can take a very long time, and you will"
set msg3 to "receive no feedback or opportunity to cancel once selected."
set verifyOption to button returned of 
	(display dialog msg1 & msg2 & msg3 buttons {a, b, c} 
		default button 3 with icon 2)
if verifyOption is b then set verifyOption to " "
if verifyOption is c then set verifyOption to " -noverify "
try
	do shell script "sudo df -k" with administrator privileges -- just here to get sudo rights only once
on error errMSG
	display dialog errMSG & return & "Please try again." as string
	return
end try
with timeout of 60000 seconds
	repeat with i from 1 to number of items in theDMGs
		set theDMG to item i of theDMGs
		set mountDMGs to "sudo hdiutil attach" & verifyOption & "\"" & 
			(POSIX path of theDMG) & "\""
		try
			do shell script mountDMGs
			display dialog "Disk Mount of disk image " & return & (theDMG as text) 
				& " is complete." giving up after 4
		on error errMSG
			display dialog errMSG
		end try
	end repeat
	if (number of items in theDMGs) is greater than 1 then 
		set endOpt to button returned of (display dialog 
			"All operations complete" & return & return & 
			"Send comments to frederico@mac.com" buttons {"Comments", "Cool"} 
			default button 2)
	if endOpt is "Comments" then open location "mailto:frederico@mac.com"
end timeout



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: clith on Sep 21, '04 12:47:53PM

Now, if you could add an "on open" handler that handled drag-and-drop, you'd be all set! Just drag your dmg files onto the script and they would mount. No file dialog to get in the way.. :-)



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: mlaurenc on Mar 12, '05 11:58:16PM

Hi there...

Well, I tried both versions of your script on several disk images (including one that I KNOW mounts fine by itself), and most of them were grayed out in my file dialog. My first thought was that perhaps they were corrupted, but at least one of them mounts fine on its own, and it was not accessible either.

I very much appreciate your scripting skills, but do you have any idea why I might be having such problems? Any suggestions from anyone else out there? I would really appreciate the help!

Thanks in advance,

mlaurenc



[ Reply to This | # ]