• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Ejecting An Image Disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ejecting An Image Disk


  • Subject: Re: Ejecting An Image Disk
  • From: Axel Luttgens <email@hidden>
  • Date: Fri, 31 Oct 2008 12:24:21 +0100

Le 30 oct. 08 à 15:48, Luther Fuller a écrit :

More info on Axel's question ...

On Oct 29, 2008, at 6:35 PM, Axel Luttgens wrote:

I mean, for example, why not just eject the mounted disk(s) either manually or with the help of an eject command targeted to the Finder?

The Finder's 'eject' command looks like this ...

	tell application "Finder" to eject disk <disk_name>

It requires the name of a disk and that's a problem when trying to eject an image disk. You can have two disk image files, for example "test_1.sparseimage" and "test_2.sparseimage", both of whose disks are named "test". If you ask the Finder to

	tell application "Finder" to eject disk "test"

One of the disks named "test" will be ejected and the Finder isn't picky about which one. But what I need is to eject the disk mounted from a particular disk image file. For example, if I need to eject the disk mounted from the file "test_1.sparseimage"., the only way to do this is to use the getMountPoint handler from an earlier posting, then use

	do shell script "hdiutil detach " & mountPoint & " -force"

to eject the specific disk associated with this specific disk image file. The Finder's eject command does not understand a mountPoint. (Confirmed by some experimenting over the last hour.)

Conclusion: Image disks must be ejected with 'hdiutil detach ', not via the Finder's 'eject' command.

Hello Luther,

I've been a bit late... sorry, too many things in the pipeline.

So, you're referring here to that oooold Finder's annoying behavior wrt to mounted volumes bearing identical names.
Yes, this always has required to resort to some tricks, the problem being a general one, not restricted to the ejection of volumes only.


If you allow, I tend to slightly disagree with your conlusion... ;-)

Let's say I have two disk images, a1.sparsebundle and a2.sparsebundle, both with a single volume "V".

Double-clicking a2.sparsebundle then a1.sparsebundle, I thus get two disk icons on the Desktop, both named "V"; the corresponding mount points are:
/Volumes/V <-- a2.sparsebundle
/Volumes/V 1 <-- a1.sparsebundle


As you've reported it, when scripting the Finder, the locution:
disk "V"
will tend to refer to the volume mounted in the first place, and won't allow to access the other one.


But, for example, this one will do trick:

tell app Finder to eject (disks whose url is "file://localhost/Volumes/V 1/ ")

So, strictly speaking, volumes MAY be ejected via the Finder's eject command, even in such cases.

Splitting hairs,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Ejecting An Image Disk (From: Luther Fuller <email@hidden>)
 >Re: Ejecting An Image Disk (From: Luther Fuller <email@hidden>)
 >Re: Ejecting An Image Disk (From: Luther Fuller <email@hidden>)
 >Re: Ejecting An Image Disk (From: Axel Luttgens <email@hidden>)
 >Re: Ejecting An Image Disk (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Adding File Permissions Change
  • Next by Date: Re: Ejecting An Image Disk
  • Previous by thread: Re: Adding File Permissions Change
  • Next by thread: Re: Ejecting An Image Disk
  • Index(es):
    • Date
    • Thread