• 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 and move
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mount and move


  • Subject: Mount and move
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 08 Jul 2011 09:46:12 -0500

On Jan 11, 2011, at 2:22 PM, Jeffrey Madson started a thread, Subject: "Mount and move".
I replied with a handler that would mount a disk from a disk image file and return an alias to the disk.

This handler identified the disk by parsing the text returned by

do shell script "hdiutil info "

I have recently discovered that this technique is unreliable. I have reverse engineered the -plist output of this command and the following handler should be much more reliable.

on mountImageDisk(imageFileAlias)
-- imageFileAlias is an alias to the Mail-Safe sparsebundle file
-- returns an alias to the disk mounted from imageFileAlias
tell application "Finder" to open imageFileAlias
--
set found to false
set imageFileText to (imageFileAlias as text)
repeat 20 times
delay 1
set imageInfo to (do shell script "hdiutil info -plist ")
tell application "System Events"
set infoRecord to value of (make property list item with properties {text:imageInfo})
end tell
set imagesList to (get images of infoRecord)
repeat with n from 1 to (count items of imagesList)
set imagesItem to (item n of imagesList)
set imagePath to (get |image-path| of imagesItem)
set imagePath to (POSIX file imagePath) as alias as text
if imagePath = imageFileText then
set systemEntities to (|system-entities| of imagesItem)
repeat with k from (count items of systemEntities) to 1 by -1
try
set volName to (|mount-point| of (item k of systemEntities))
set found to true
exit repeat
end try
end repeat
exit repeat
end if
end repeat
if found then exit repeat
end repeat
if not found then error "Unable to mount the image disk."
set diskAlias to (POSIX file volName) as alias
return diskAlias -- an alias to the disk mounted from the disk image file
end mountImageDisk ------------------------------------------------------

 _______________________________________________
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

  • Prev by Date: Re: Cloaking Device
  • Next by Date: TIME TO GMT and Summer time
  • Previous by thread: Re: Pinecode replacement
  • Next by thread: TIME TO GMT and Summer time
  • Index(es):
    • Date
    • Thread