【问题标题】:AppleScript throwing error on hdiutil commandAppleScript 在 hdiutil 命令上抛出错误
【发布时间】:2013-11-28 08:31:03
【问题描述】:

我在 AppleScript 文件中有以下代码,它应该挂载一个托管在我的网络上的 sparsebundle。运行此脚本会在 hdiutil 命令上引发错误:

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

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

我收到的错误是:

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

在终端中运行 shell 脚本代码可以正常工作,并且脚本可以正常构建。有什么想法吗?

【问题讨论】:

    标签: macos applescript osx-mountain-lion hdiutil


    【解决方案1】:

    搞定了。我更改了hdiutil 命令语法,现在AppleScript 不会抛出错误。

    try
      mount volume "smb://192.168.1.1/sda2"
    end try
    
    do shell script "hdiutil attach /Volumes/sda2/timemachine.sparsebundle/"
    

    不知道为什么原来的命令在终端中仍然有效,但在 AppleScript 中失败,但至少现在有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-28
      • 2016-12-10
      • 2017-04-06
      • 2021-07-29
      • 2022-01-24
      • 2019-05-23
      • 2019-10-29
      相关资源
      最近更新 更多