• 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 14:26:07 +0100

Le 28 oct. 08 à 18:42, Luther Fuller a écrit :

In the script below, both the run handler and the open handler do the same thing, they call the ejectImageDisk handler. They both work correctly. Except ...

Notice the execution times in the lines marked with <<<<<<<. When called from run, the disk is almost instantly ejected, but when called from open, there is a very long delay until ejection. That shouldn't be!

Does anyone have an explanation?
[...]

Let's try to reduce the phenomenon to its bare components and save this one as a droplet:


on run
	set start to current date
	do shell script "hdiutil detach /dev/disk1 -force"
	display dialog (current date) - start
end run
on open
	set start to current date
	do shell script "hdiutil detach /dev/disk1 -force"
	display dialog (current date) - start
end open

This relies on the kind of data returned by the getMountPoint() handler you've sent later in the thread.

Here, under Leopard, I can't notice any difference between a run event (double-clicking the droplet) and an open event (dragging some item over the droplet): in both cases, the delay is rather long (17-18 seconds).

So, sorry, no explanation available here. ;-)
I mean, wrt the above question.

But the delays are indeed rather long, as if too many notifications were to be handled and synchronized from various parts of the system. Yet, it seems one may provide some hints by first unmounting the volume, then detaching the image:

on run
	set start to current date
	do shell script "umount -f /dev/disk1s2; hdiutil detach /dev/disk1"
	display dialog (current date) - start
end run
on open
	set start to current date
	do shell script "umount -f /dev/disk1s2; hdiutil detach /dev/disk1"
	display dialog (current date) - start
end open

The delays are now within the 1-2 seconds range.

HTH,
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
  • Follow-Ups:
    • Re: Ejecting An Image Disk
      • From: Luther Fuller <email@hidden>
References: 
 >Ejecting An Image Disk (From: Luther Fuller <email@hidden>)

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