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

Re: Mount and move


  • Subject: Re: Mount and move
  • From: Luther Fuller <email@hidden>
  • Date: Tue, 11 Jan 2011 15:45:14 -0600

On Jan 11, 2011, at 2:22 PM, Jeffrey Madson wrote:
I'm trying to mount a disk image from a specified folder to the desktop then move the application within the disk image back to the same folder and then unmount the disk image. I can mount the disk image using the script below but I am not having any luck moving it or unmounting the disk image. As always, thanks for your help.

tell application "Finder"

do shell script "hdiutil attach /Users/Shared/Options/Adobe/AcroProv1000_en_US.dmg"

move "/release/adobe_provisioning_tool" to "hdiutil attach /Users/Shared/Options/Adobe"

end tell


I have a couple of handlers that I use for mounting/unmounting image disks.
I've removed most of the code, since it's not applicable here.

on mountImageDisk(imageFileAlias)
-- imageFileAlias is an alias to the disk image file
tell application "Finder" to open imageFileAlias
--
set posixPath to (POSIX path of imageFileAlias)
if last character of posixPath is "/" then set posixPath to (text 1 thru -2 of posixPath)
repeat -- while Finder mounts the disk
try
delay 1
set imageInfo to (do shell script "hdiutil info")
set AppleScript's text item delimiters to {posixPath}
set imageInfo to (text item 3 of imageInfo)
set AppleScript's text item delimiters to {"/dev"}
set imageInfo to (text item 2 of imageInfo)
set AppleScript's text item delimiters to {tab & "/Volumes"}
set imageInfo to (text item 2 of imageInfo)
set AppleScript's text item delimiters to {return}
set volName to ("/Volumes" & (text item 1 of imageInfo))
exit repeat
end try
end repeat
set diskAlias to (POSIX file volName) as alias
return diskAlias -- an alias to the disk mounted from the disk image file
end mountImageDisk

on unMountImageDisk(diskAlias)
-- diskAlias is an alias to the disk mounted from the disk image file
tell application "Finder" to eject diskAlias
end unMountImageDisk

All of the code in mountImageDisk after the first line is necessary in order to get a valid alias to the disk mounted from the image file. The name of the image file and the name of the disk it mounts are not necessarily the same name.

 _______________________________________________
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: 
 >Mount and move (From: Jeffrey Madson <email@hidden>)

  • Prev by Date: Re: How to do a goto with Applescript?
  • Next by Date: Re: How to do a goto with Applescript?
  • Previous by thread: Re: Mount and move
  • Next by thread: How to delete extraneous plist files via AppleScript
  • Index(es):
    • Date
    • Thread