自动化错误中的AppleScript("操作"运行AppleScript"遇到错误")

ber*_*tis 3 applescript automator

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

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
Run Code Online (Sandbox Code Playgroud)

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

ber*_*tis 8

哦,我的上帝,我觉得这么愚蠢,唯一需要的是授予应用程序的可访问性权限,我正在使用此服务:).

  • 你不是傻瓜!此错误消息是垃圾! (6认同)
  • 转到(Mac OS)设置 - >安全和隐私 - >辅助功能 - >找到运行该服务的应用程序,在我的情况下是其Finder (3认同)
  • 即使应用程序在“首选项>安全和隐私>隐私”选项卡中已经有复选标记,也发生在我身上。关闭然后再次打开复选框解决了这个问题。 (2认同)