This is very handy. I don't know anything about scripting, but I'm wondering if it would be a simple thing to create a version of that script that does the following:
Ejects all disk images (not disks).
That's it. No selecting, no trashing, just a one-button disk image ejector.
Failing that, I presume that deleting the second half of your script will do the ejecting part without the trashing part, as so:
echo "$@" >/dev/stderr
log "name=$dmgname, mount=$dmgmount, path=$dmgpath"
out="$( hdiutil detach "$dmgmount" 2>&1 )"
if [[ $hds -ne 0 ]]; then
log "hdiutil exit status: $hds"