Below is an Applescript for mounting multiple sparsebundle disk images on the Desktop, all linked to a single password. When the app is launched, a password window appears, the password is entered and several disk images mount sequentially on the desktop. I've only included the Applescript for the first disk image, diskname1. The formating below does not match compiled Applescript but I have no way to change the colors of the fonts here.
The "Tell Application"… thru "End Tell" sequence repeats itself for diskname2 - diskname10 and the app works very well.
property diskname1 : "Clients"
property diskpath1 : "Macintosh HD:Users:Batman:Documents:DiskImages:Clients.sparsebundle"
on run
set thePassword to "none"
set passwordBox to display dialog "Enter the password:" buttons {"Cancel", "OK"}
default button {"OK"} default answer "" with icon 2 giving up after 30 with
hidden answer
if gave up of passwordBox is true then
set myButton to "Cancel"
quit
else
set thePassword to the text returned of passwordBox
end if
tell application "Finder"
if not (exists the disk diskname1) then
do shell script ("hdiutil attach " & quoted form of ¬
POSIX path of (diskpath1 as string) & " -mount required -passphrase "
& thePassword)
repeat until name of every disk contains diskname1
delay 0.1
end repeat
end if
end tell
[diskname2 - diskname 10 sequences repeat here…]
endrun
I found another piece of Applescript online, intended to mount a disk image inside the documents folder. I've tried incorporating it into the script above to make it mount multiple disk images in the Documents folder instead of on the Desktop, but have not yet succeeded. Can anyone merge these two Applescript sequences to make a single, working script that mounts (sets the mount point for) multiple disk images to be inside the Documents folder?
set _mountLocation to POSIX file "/Users/<username>/Documents/"
mountdisk image_filemount location_mountLocation