eject every disk / 10.10

Oh well, it was good whilst it lasted.

I have a tiny, one line app that does exactly what it says on the tin

tell application "Finder" to eject (every disk whose ejectable is true)

Works fine prior to 10.10. No user prompting, just does exactly what it should, silently

10.10 Behaviour: It prompts the user with an eject dialog for every partition, even if on the same physical drive :frowning:

You could see if the same thing happens with the ASObjC equivalent:

use framework "Foundation"
use framework "AppKit"

set theList to (current application's NSFileManager's defaultManager()'s mountedVolumeURLsIncludingResourceValuesForKeys:({current application's NSURLVolumeNameKey}) options:0) as list
set theNSWorkspace to current application's NSWorkspace's sharedWorkspace()
repeat with i from 1 to count of theList
	set thePath to (item i of theList)'s path()
	set {theResult, isUnmountable} to (theNSWorkspace's getFileSystemInfoForPath:thePath isRemovable:(missing value) isWritable:(missing value) isUnmountable:(reference) |description|:(missing value) |type|:(missing value))
	if theResult and isUnmountable as boolean = true then
		(theNSWorkspace's unmountAndEjectDeviceAtURL:(item i of theList) |error|:(missing value))
	end if
end repeat

Cheers for the reply Shane. A shame that a one line app has turned into ten. Progress, eh?

Well it’s progress that we have workarounds for some of these bugs… :slight_smile:

Fails to compile on: set thePath to (item i of theList)'s path()

Probably a terminology conflict. try β€œ|path|()”.

Fixed! Thanks Shane!