An Automator workflow that mounts a disk image on when I drag and drop the dmg file onto it is easy:
Instead of dragging and dropping the dmg file I want to double click the created workflow and have it mount a specific file. I've tried using "Set Value of Variable" to the path of the dmg, "Open Finder Items", and "Get Selected Folder Items", nothing works.
I can do it with the command line as:
hdiutil mount disk_image_name.dmg
I've also tried with the Applescript:
on run {input, parameters}
tell application "DiskImageMounter"
open "path/disk_image_name.dmg"
end tell
end run
But after mounting the disk image as expected, Automator freezes for about 15 seconds and gives the below Syntax Error.
The reason I want to avoid using hdituil is the disk images are encrypted. When using the Automator mount tool the password is done in Apple's dialog box. Using hdiutil I end up passing the password as stdin.
printf '%s\0' "$PASSPHRASE" | hdiutil attach $LOCATION -stdinpass
hdiutil mount ...
with a p12 but no password (cert based disk image protection with the keychain which requires a password only once). Takes ~3 minutes work in the shell and requires run shell script >hdiutil mount /path/to/disk_image_name.dmg
in a workflow only