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


Click here to return to the 'A script to eject and spin down external drives: Modified' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to eject and spin down external drives: Modified
Authored by: morphis on Dec 10, '04 01:29:08PM
I modified the AppleScript to only grep for volName The result is that it now works for both volumes that have user defined mountpoints and Volumes that have spaces in there names.

Also there is only one thing you have to edit .
And there are now error messages.
###########################################
set VolToSpinDown to "<YourVolumeName>"

if (do shell script "echo `disktool -l | grep -c \"volName = '" & VolToSpinDown & "'\"`") as number is 1 then
	set VolInfo to do shell script ¬
		"echo `disktool -l | grep \"volName = '" & VolToSpinDown & "'\"`"
	
	set VolPath to do shell script ¬
		"echo \"" & VolInfo & "\" |  awk -F \"'\" '{ print $4 }'"
	if VolPath is not "" then
		set VolDev to do shell script ¬
			"echo \"" & VolInfo & "\" |  awk -F \"'\" '{ print $2 }'"
		if VolDev is not "" then
			--########################################	
			try
				do shell script "touch " & VolPath & "/.dummy"
			on error the error_message number the error_number
				DisplayError("[" & (error_number as text) & "]
" & error_message)
			end try
			try
				do shell script "hdiutil eject " & VolDev
			on error the error_message number the error_number
				DisplayError("[" & (error_number as text) & "]
" & error_message)
			end try
			--########################################	
		else
			DisplayError("Could not get Device for Volume " & VolToSpinDown)
		end if
	else
		DisplayError("Volume " & VolToSpinDown & " is not Mounted")
	end if
else
	DisplayError("Volume " & VolToSpinDown & " is not Connected")
end if

on DisplayError(message)
	display dialog message buttons {"Cancel"} default button 1 with icon stop
end DisplayError
###########################################

[ Reply to This | # ]
A script to eject and spin down external drives: Modified
Authored by: Baby Bloc on Feb 07, '05 03:17:29PM

Is there any way to spin down external firewire drives that are partitioned? The scripts I see all require single volume names...



[ Reply to This | # ]