问题描述
我需要从命令行重新加载"一个 Safari 扩展(并且稍后构建包).
I need to "Reload" a Safari extension from the command line (and also build the package later).
如何做到这一点?
我想一步构建 - 我的代码是在 CoffeeScript 中的,因此我无论如何都要编译它.
I'd like to build in one step - my code is in CoffeeScript and thus I'm compiling it anyway.
除了绝望地谷歌搜索之外,我还尝试使用这个 AppleScript:
Apart from googling hopelessly I tried using this AppleScript:
tell application "System Events"
tell process "Safari"
click the button "Reload" of window "Extension Builder"
end tell
end tell
出现以下错误:
系统事件出错:无法获取进程Safari"的窗口Extension Builder"的重新加载"按钮.
还有这个变化:
tell application "System Events"
tell process "Safari"
tell button "Reload" of window "Extension Builder" to perform action
end tell
end tell
这不会产生错误,但实际上也没有做任何事情.
Which doesn't give an error but also doesn't actually do anything.
推荐答案
按钮可能没有像您预期的那样命名".查看 UI 浏览器,以查看用于 GUI 脚本的应用程序界面层次结构.
It may be that the button isn't "named" as you expect. Check out UI Browser in order to view an application's interface hierarchy for use with GUI scripting.
重新加载"按钮可通过以下方式访问:
The "Reload" button is accessible with:
click button "Reload" of UI element "ReloadUninstall[NAME OF EXTENSION HERE]" \
of UI element 1 of scroll area 1 of window "Extension Builder"
这篇关于如何从命令行重新加载 Safari 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!