Speeding up the Eject Volumes applescript

General discussions about LaunchBar
Post Reply
ZevEisenberg
Posts: 8
Joined: Wed Jun 04, 2008 6:48 pm
Contact:

Speeding up the Eject Volumes applescript

Post by ZevEisenberg » Wed Jun 04, 2008 6:59 pm

I usually have a few hard drives and/or mounted servers connected to my laptop, and I discovered the Eject All Ejectable Volumes applescript included with LaunchBar. I used it for a while, but it seems that at some point it became sluggishly slow. When I invoke it, LaunchBar hangs for a while, then finally ejects the disks. Here's the original script:


Code: Select all

-- Copyright (c) 2006-2008 Objective Development
-- http://www.obdev.at/
-- Version 3

tell application "Finder"
   if ((count of disks) > 1) then
      set all_disks to disks
      repeat with d in all_disks
         eject d
      end repeat
   end if
   open location "x-launchbar:hide"
end tell


I thought that the hang might be due to the script trying to eject the boot volume, so I modified the script to filter out the boot volume with a conditional:


Code: Select all

-- Copyright (c) 2006-2008 Objective Development
-- http://www.obdev.at/
-- Version 3, modified by Zev Eisenberg

tell application "Finder"
   if ((count of disks) > 1) then
      set all_disks to disks
      repeat with d in all_disks
         if d is not equal to "Macintosh HD" then
            eject d
         end if
      end repeat
   end if
   open location "x-launchbar:hide"
end tell


This didn't help.
1. Is this a valid modification, or is d not, in fact, equal to the name of the drive?

2. Is ejecting the boot volume the problem?

3. What would speed the script up?

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Thu Jun 05, 2008 11:20 pm

I can't really answer any of those, but simply running

Code: Select all

tell application "Finder"
   disks
end tell

shows you that d in your script is equal to

Code: Select all

startup disk of application "Finder"

so maybe you should try to use that.

tell me if it works for you (I don't have that delay),
Ludwig

norbert
Objective Development
Objective Development
Posts: 648
Joined: Thu Nov 09, 2006 6:30 pm

Re: Speeding up the Eject Volumes applescript

Post by norbert » Sun Jun 08, 2008 6:11 pm

ZevEisenberg wrote:... I discovered the Eject All Ejectable Volumes applescript included with LaunchBar. I used it for a while, but it seems that at some point it became sluggishly slow. When I invoke it, LaunchBar hangs for a while, then finally ejects the disks.

It's a deadlock that only occurs on Leopard. This problem will be fixed in LaunchBar 4.4.

Post Reply