【问题标题】:AppleScript in automator error ("The action "Run AppleScript" encountered an error ")AppleScript in automator 错误(“操作“运行 AppleScript”遇到错误”)
【发布时间】:2021-03-27 03:12:29
【问题描述】:

我想找到一种通过键盘快捷键禁用/启用热角的方法。 我找到了这个苹果脚本

property theSavedValues : {"Mission Control", "Desktop", "Dashboard", "Launchpad"} -- for example

tell application "System Preferences"
    set current pane to pane id "com.apple.preference.expose"
    tell application "System Events"
        tell window "Mission Control" of process "System Preferences"
            click button "Hot Corners…"
            tell sheet 1
                tell group 1
                    set theCurrentValues to value of pop up buttons
                    if theCurrentValues is {"-", "-", "-", "-"} then
                        repeat with i from 1 to 4
                            set thisValue to item i of theSavedValues
                            tell pop up button i
                                click
                                click menu item thisValue of menu 1
                            end tell
                        end repeat
                    else
                        copy theCurrentValues to theSavedValues
                        repeat with i from 1 to 4
                            tell pop up button i
                                click
                                click last menu item of menu 1
                            end tell
                        end repeat
                    end if
                end tell
                click button "OK"
            end tell
        end tell
    end tell
    quit
end tell

所以我用这个苹果脚本在 Automator 中创建了一个服务,将它附加到键盘快捷键上,每当我在 automator 中运行这个脚本时,它就可以工作,但是当我点击快捷方式时,我得到“操作”运行 AppleScript“遇到错误”。 有什么想法可以解决这个问题吗? 谢谢

【问题讨论】:

    标签: applescript automator


    【解决方案1】:

    天哪,我觉得自己太笨了,唯一需要做的就是为我正在使用此服务的应用授予可访问权限:)。

    您可以通过转到 (Mac OS) 设置 -> 安全和隐私 -> 辅助功能 -> 并找到您运行服务的应用程序来执行此操作。 (就我而言,它是 Finder。)

    【讨论】:

    • 转到 (Mac OS)Settings -> Security&Privacy -> Accessibility -> 并找到您正在运行该服务的应用程序,在我的例子中是它的 Finder
    • 发生在我身上,即使该应用程序已经在“首选项 > 安全和隐私 > 隐私”选项卡中有复选标记。关闭复选框然后再次打开解决了它。
    • 感谢@beretis 发布您的解决方案。我尝试了一切,但是当我将 Safari 添加到“辅助功能”选项卡时,它开始工作......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-12
    • 2012-07-27
    • 1970-01-01
    • 2022-01-16
    • 2011-10-26
    • 1970-01-01
    相关资源
    最近更新 更多