Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

FastScript hangs for this script, but Script Debugger does not

edited October 2008 in FastScripts
I wrote the "Eject Volumes and Trash Images" AppleScript below. It ejects all selected volumes in the Finder. If any of those volumes were mounted from a disk image, the script trashes the corresponding image file.

When I run this from within my script editor, Script Debugger, it works fine and quickly.

If I launch it from the FastScripts menu, there is a pause of over 20 seconds. spits out this message sometime during the hang:

29.10.08 29.10 19:02:11  diskarbitrationd daemon Error FastScripts [233]:36611 not responding.

After the pause, the script does its job as expected.

Is this a bug in FastScripts?

set myVolumes to getSelectedVolumes()
if (count myVolumes) < 1 then return

set myImages to getImageList()

repeat with myVolume in myVolumes
set myImagePath to \"\"
set myImageFile to null
repeat with myImage in myImages
set mountPoint to |mount-point| of item 3 of |system-entities| of myImage
displayed name of myVolume
if mountPoint = (\"/Volumes/\" & displayed name of myVolume) then
set myImagePath to |image-path| of myImage
set myImageFile to POSIX file myImagePath
end if
end repeat

tell application \"Finder\"
eject myVolume
if myImageFile is not null then
delete file myImageFile
end try
end if
end tell
end repeat

on getSelectedVolumes()
set volumeList to {}
tell application \"Finder\"
set mySelection to selection
repeat with myItem in mySelection
set myItem to contents of myItem
-- log class of myItem
if kind of myItem is \"Volume\" then
set end of volumeList to myItem
end if
end repeat
end tell
return volumeList
end getSelectedVolumes

on getImageList()
set diskinfo to do shell script \"hdiutil info -plist\"
tell application \"System Events\"
set diskinfo to value of (make new property list item with properties {text:diskinfo})
set imageList to |images| of diskinfo
end tell
return imageList
end getImageList


  • I have seen similar problems like this when scripting the Finder's disk ejection. I think it's a bug somehow in the Finder or the disk ejection functionality, and I suspect it's something that affects any client (such as FastScripts) that is a background application. I haven't figured out all the details yet, though.

    Some people have found that writing a shell script that communicates with the Finder addresses the problem. Apparently scripting the Finder from the shell script doesn't exhibit the same problem as scripting from FastScripts.

    I wish I had better news about this issue but for now my best suggestion is to try to workaround it somehow with a shell script.

Sign In or Register to comment.