AppleScript choose file with Terminal action

applescriptterminal

I would to choose a file/an image that is being mounted in the Terminal

set pathelection to POSIX path of (choose file of type {"sparsebundle", "sparseimage", "dmg"})

do shell script "hdiutil mount" & " " & pathelection

Best Answer

Well, I have no clue what you want, but your code isn't guaranteed to work, which may be your problem. Try this:

set image to POSIX path of (choose file of type {"sparsebundle", "sparseimage", "dmg", "cdr", "iso"})
do shell script "hdiutil mount " & quoted form of image

Source: Part-time work as a prophet