Le 28/02/2013 à 17:15, Robert Poland <
email@hidden> a écrit :
Hi,
I'm trying to create a script that will close a disk image if it exists.
This is one of my attempts;
tell application "Finder"
activate
if exists disk image("/Users/rpoland/Stuff.sparseimage") then
beep 2 -- for testing
-- eject image "Stuff~ƒ"
end if
end tell
Any ideas would be appreciated.
--[SCRIPT]
set leDisque to choose folder # returns an alias
# Check that the selected folder is a disk
# I don't use kind which is localized
tell application "Finder"
if class of (get properties of leDisque) is not disk then error number -128
end tell
# The type identifier of a disk image is of the kind : dyn.age8u
# I'm sure for the "dyn." part, not for the "age" part.
# So I check only the first four characters.
tell application "System Events"
if type identifier of leDisque does not start with "dyn." then error number -128
end tell
tell application "Finder"
eject leDisque
end tell
--[/SCRIPT]