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