Eject/unmount a volume

Hello,
I begin in applescript.
I succeed to mount a disc image (.dmg) like this.

do shell script "hdiutil mount " & "/Users/iMac/Desktop/Sauvegardes.dmg

or like this


tell application “DiskImageMounter”
open “/Users/iMac/Desktop/Sauvegardes.dmg”
end tell

I don’t know which line is the best one.

I don’t know how to eject/unmount/close the volume.

Before, I want to copy a folder in the volume, I don’t know how to access it.

Thank you.

Rémy.

Hi,

both lines to mount an image are good. I would prefer the shell script.
Does DiskImageMouter really work with the POSIX path, normally AppleScript uses “Mac HD:Users:iMac…” paths.

To unmount an image you can use

do shell script "hdiutil unmount '/Volumes/the Volume'" -- the single quotes are only needed, if there are space characters in the name

or

tell application "Finder" to eject disk "the Volume"