自动程序中的 AppleScript 错误("The action "运行 AppleScript“遇到错误”)
AppleScript in automator error ("The action "Run AppleScript" encountered an error ")
我想找到一种通过键盘快捷键 disable/enable 热角的方法。
我找到了这个苹果脚本
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 中 运行 这个脚本时,它就可以工作,但是当我点击快捷方式时,我得到 "The action "运行AppleScript“遇到错误”。
有什么想法可以解决这个问题吗?
谢谢
天哪,我觉得自己太蠢了,唯一需要做的就是向我使用此服务的应用程序授予可访问性权限:)。
您可以转到 (Mac OS)设置 -> 安全和隐私 -> 辅助功能 -> 并找到您从中获得 运行 服务的应用。 (在我的例子中是 Finder。)
我想找到一种通过键盘快捷键 disable/enable 热角的方法。 我找到了这个苹果脚本
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 中 运行 这个脚本时,它就可以工作,但是当我点击快捷方式时,我得到 "The action "运行AppleScript“遇到错误”。 有什么想法可以解决这个问题吗? 谢谢
天哪,我觉得自己太蠢了,唯一需要做的就是向我使用此服务的应用程序授予可访问性权限:)。
您可以转到 (Mac OS)设置 -> 安全和隐私 -> 辅助功能 -> 并找到您从中获得 运行 服务的应用。 (在我的例子中是 Finder。)