Here's the corrected handler ...
on mountImageDisk(imageFileAlias)
-- imageFileAlias is an alias to a disk image file (.dmg, .sparseimage, .sparsebundle)
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
(POSIX file volName) as alias
return the result -- an alias to the disk mounted from the disk image file
end mountImageDisk -----------------------------------------