• 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: Eject image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eject image


  • Subject: Re: Eject image
  • From: "koenig.yvan" <email@hidden>
  • Date: Thu, 28 Feb 2013 18:26:15 +0100


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]

may help.

Yvan KOENIG (VALLAURIS, France) jeudi 28 février 2013 18:26:10



 _______________________________________________
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: 
 >Eject image (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Eject image
  • Next by Date: Re: Eject image
  • Previous by thread: Re: Eject image
  • Next by thread: Re: Eject image
  • Index(es):
    • Date
    • Thread