运行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”

我的自动化工作流程如下

Workflow screenshot

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

我已允许访问“安全性隐私”>“磁盘访问权限完全相同”。

我已允许以下人员访问“安全性隐私”>“自动化”:Automator> QuickTime Player和Terminal> Finder

请给我任何帮助。

解决方法

该错误与辅助功能和完整磁盘访问无关

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

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

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

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...