• 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
Mount Disk Image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mount Disk Image


  • Subject: Mount Disk Image
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 07 Nov 2014 21:10:24 -0600

Hey Folks,

I've gotten annoyed with manually installing various things from disk images, and I'm in the process of writing my own installer.

The mount code is working nicely, so I thought I'd pass it on.

--
Best Regards,
Chris

-------------------------------------------------------------------------

tell application "Finder"
  set fndrSel to selection as alias list
  if length of fndrSel = 1 then
    set dskImgAlias to first item of fndrSel
    if dskImgAlias's kind does not contain "Disk Image" then ¬
      error "Selected File is not a Disk Image!"
  else
    error "Problem with Finder Selection!"
  end if
end tell

set posixPath to POSIX path of dskImgAlias
set shCMD to "yes | hdiutil mount " & qf(posixPath) & ¬
  " 2> /dev/null | sed -En 's!^.+(\\/Volumes\\/.+)!\\1!p'"
set diskImgAlias to alias POSIX file (do shell script shCMD)

tell application "Finder"
  open diskImgAlias # Redundant when disk image auto-opens, but who cares.
  set itemList to (items of diskImgAlias whose kind is not "Alias") as alias list
end tell

-------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------
on qf(_text)
  return (quoted form of _text)
end qf
-------------------------------------------------------------------------

 _______________________________________________
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: Mount Disk Image
      • From: Brandon Usher <email@hidden>
  • Prev by Date: [ANN] Update to ASObjCextras.framework
  • Next by Date: Re: Mount Disk Image
  • Previous by thread: Re: [ANN] Update to ASObjCextras.framework
  • Next by thread: Re: Mount Disk Image
  • Index(es):
    • Date
    • Thread