Applescript问题:"不允许辅助访问。 (-1719)"

时间:2016-03-24 21:04:54

标签: macos applescript

我写了下面的AppleScript来打开文档,同时还在我的文字处理器应用程序中隐藏了一些恼人的持久工具栏。当我直接从脚本编辑器播放时,它工作得很好。但当我把它变成一个应用程序,并尝试在Alfred(而不是Alfred 2)中玩时,我得到了这个:

Open "Bicycle" is not allowed assistive access. System Events got an error: Open "Bicycle" is not allowed assistive access. (-1719)

哦,我尝试了比#34; POSIX"更普通的路线,但都带来了相同的结果。另外,我正在运行最新版本的El Capitan。

tell application "Bean"
open POSIX file "/Users/MyDrive/Documents/Bicycle.rtf"

end tell
activate application "Bean"
delay 0.3

tell application "System Events"
tell process "Bean"

    click menu item "Hide Ruler" of menu 1 of menu bar item "View" of menu bar 1

    click menu item "Hide Status Bar" of menu 1 of menu bar item "View" of menu bar 1

    click menu item "Hide Toolbar" of menu 1 of menu bar item "View" of menu bar 1

end tell
end tell

1 个答案:

答案 0 :(得分:1)

由于

  

"自行车"不允许辅助访问

通过打开允许它 System Preferences> Security & Privacy> Privacy> Accessibility
并选中相应的复选框。