2

I have the following code in an AppleScript file, which should mount a sparsebundle hosted on my network. Running this script throws an error on the hdiutil command:

try
  mount volume "smb://192.168.1.1/sda2"
end try

do shell script "hdiutil attach -mountpoint /Volumes/sda2 timemachine.sparsebundle"

The error I'm receiving is:

hdiutil: attach failed - No such file or directory" number 1

Running the shell script code in Terminal works just fine, and the script builds fine. Any ideas?

Cœur
  • 37,241
  • 25
  • 195
  • 267
alkalinecoffee
  • 1,003
  • 8
  • 20

1 Answers1

4

Got it working. I changed the hdiutil command syntax and now AppleScript does not throw an error.

try
  mount volume "smb://192.168.1.1/sda2"
end try

do shell script "hdiutil attach /Volumes/sda2/timemachine.sparsebundle/"

Not sure why the original command still works in Terminal but fails in AppleScript, but at least it works now.

alkalinecoffee
  • 1,003
  • 8
  • 20