在 Applescript 中,如何才能像 Spotlight 一样进入“帮助”菜单“搜索”字段?

发布于 2024-07-05 09:41:06 字数 153 浏览 4 评论 0原文

在 OS X 中,为了从键盘快速访问菜单项,我希望能够键入组合键,让它运行脚本,并使脚本将焦点集中在“帮助”菜单中的“搜索”字段。 它应该像 Spotlight 的组合键一样工作,所以如果我再次运行它,它应该会关闭菜单。 我可以使用 Quicksilver 运行脚本,但是如何编写脚本呢?

In OS X, in order to quickly get at menu items from the keyboard, I want to be able to type a key combination, have it run a script, and have the script focus the Search field in the Help menu. It should work just like the key combination for Spotlight, so if I run it again, it should dismiss the menu. I can run the script with Quicksilver, but how can I write the script?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绅刃 2024-07-12 09:41:06

或者,点击 cmd-? 并且不要弄乱脚本。 :-) 这将重点放在帮助菜单的搜索字段中。

Alternatively, hit cmd-? and don't mess with the script. :-) That puts key focus in the help menu's search field.

最单纯的乌龟 2024-07-12 09:41:06

这是我想出的脚本。

tell application "System Events"
    tell (first process whose frontmost is true)
        click menu "Help" of menu bar 1
    end tell
end tell

Here is the script I came up with.

tell application "System Events"
    tell (first process whose frontmost is true)
        click menu "Help" of menu bar 1
    end tell
end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文