首页 > 解决方案 > 运行 Apple 脚本时自动化失败

问题描述

您好,我在 Automator 中使用这个 Apple 脚本来快速自动启动和播放全屏视频。

tell application "QuickTime Player"
    set theMovie to open file "Users:ronaldwise:Movies:Jarvis Startup.mp4"
    tell theMovie
        set the presenting to true
        set the looping to false
        play
    end tell
end tell

当我在 automator 中按下 play 时,脚本运行得很好,但是,当我尝试在 automator 之外启动自动化应用程序时,我会收到此消息。

““运行 AppleScript”操作遇到错误“未授权将 Apple 事件发送到 QuickTime Player”

我的自动化工作流程如下所示

工作流程截图

我已允许访问安全隐私 > 可访问以下应用程序:终端、Consul、AEServer、Automator、Consul 和 Quicktime 播放器。

我已允许访问安全隐私>对上面列出的相同程序的全盘访问。

我已允许访问 Security Privacy > Automation 以进行以下操作:Automator>QuickTime Player 和 Terminal>Finder

我不知所措,请提供任何帮助。

标签: applescriptactionautomatorquicktimeappleevents

解决方案


该错误与可访问性和全盘访问无关

您必须在脚本应用程序的 Info.plist 中添加键NSAppleEventsUsageDescription

使用 Finder 在 Finder 中打开应用程序包Right-click > Show Package Contents,然后使用文本编辑器打开Info.plist文件Contents并插入

<key>NSAppleEventsUsageDescription</key>
<string>Jarvis needs to control QuickTime Player</string>

键值对的位置无关紧要,但不能直接跟随一条key线。


推荐阅读