【问题标题】:How to set AppleScript Entitlements for Finder?如何为 Finder 设置 AppleScript 权利?
【发布时间】:2017-03-31 23:52:32
【问题描述】:

我需要在启用沙盒的应用中使用 AppleScript。只需使用诸如“告诉 Finder bla-bla-bla”之类的东西。很简单。我知道我需要在 Entitlements 中为 finder 做一个记录,如下所示:

<key>com.apple.security.scripting-targets</key>
<dict>
    <key>com.apple.mail</key>
    <array>
        <string>com.apple.mail.compose</string>
    </array>
</dict>

有人知道 Xcode for Finder 中正确的权利记录吗?我尝试使用下一个选项:

<key>com.apple.security.scripting-targets</key>
<dict>
    <key>com.apple.finder</key>
    <string>com.apple.finder</string>
</dict>

但它不起作用。

【问题讨论】:

    标签: xcode macos applescript sandbox entitlements


    【解决方案1】:

    Finder 不支持scripting targets,所以需要使用之前的临时异常。

    <key>com.apple.security.temporary-exception.apple-events</key>
    <array>
       <string>com.apple.finder</string>
    </array>
    

    【讨论】:

    • 是的,我也试过了。由于某些原因,AppleScript 不起作用。这是我的授权文件:&lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;com.apple.security.app-sandbox&lt;/key&gt; &lt;true/&gt; &lt;key&gt;com.apple.security.temporary-exception.apple-events&lt;/key&gt; &lt;array&gt; com.apple.finder` 我尝试运行下一个脚本:tell application \"Finder\" \n restart \n end tell 但什么也没发生 :-(
    • 抱歉内联代码 :-) 如何在此处设置换行符?
    • Restart 实际上是System Events 的一部分,并传递给 Finder。尝试使用System Events
    • 非常感谢!现在效果很好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    相关资源
    最近更新 更多