【问题标题】:Automation failing when running Apple script运行 Apple 脚本时自动化失败
【发布时间】:2020-09-01 14:12:15
【问题描述】:

您好,我正在 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

我已允许访问 Security privacy > 可访问以下应用程序:Terminal、Consul、AEServer、Automator、Consul 和 Quicktime player。

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

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

我很茫然请任何帮助。

【问题讨论】:

  • 您运行的是哪个版本的 macOS
  • 暂时搁置操作系统版本,如果您将工作流保存为应用程序,则可能是该应用程序需要特殊访问权限(可能不是所有列出的)。
  • 我也给了申请权限。可访问性和磁盘访问。我正在运行 ios11.0

标签: applescript action automator quicktime appleevents


【解决方案1】:

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

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

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

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

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

【讨论】:

  • 但是你是怎么做到的。几个小时以来,我一直在试图弄清楚如何让它发挥作用。我对这种事情并不熟悉,也从未编写过任何类型的自动化程序或编写过任何代码。老实说,我很惊讶我想出了这么多。这个过程是什么样的?
  • 所以我添加了提示我允许访问的建议密钥。现在在安全和隐私中 QuickTime 播放器列在终端下方。但是,当应用程序在登录时启动时,我仍然收到相同的错误。 ““运行 AppleScript”操作遇到错误:“未授权将 Apple 事件发送到 QuickTime Player”
猜你喜欢
  • 2017-08-15
  • 1970-01-01
  • 1970-01-01
  • 2022-01-12
  • 1970-01-01
  • 1970-01-01
  • 2018-04-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多