Applescript 推出 Spotlight?
我尝试使用以下命令打开 Spotlight 搜索框:
tell application "System Events"
keystroke " " using {command down}
end tell
它只是尝试发出命令空格。它确实有效,但如果我将脚本保存为应用程序并运行它,Spotlight 窗口会显示,然后立即消失。
为什么会发生这种情况?我该怎么做才能保持 Spotlight 窗口打开?
或者:如何使用 Applescript 打开 Spotlight 搜索框?
I tried to use the following to open the Spotlight search box:
tell application "System Events"
keystroke " " using {command down}
end tell
It simply tries to issue command-space. It does work, but if I save the script as an Application and run it, the Spotlight window shows up and then promptly disappears afterwards.
Why does this happen and what can I do to keep the Spotlight window open?
Alternatively: How do I open the Spotlight search box using Applescript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的脚本将打开 Spotlight菜单。打开 Spotlight 窗口的键盘快捷键是 command + option + space...
更新: 根据您修改后的答案,我编写了一个小脚本,应该可以完成您想要的操作...
您可以在 [1] 中执行以下操作之一:
打开顶部点击:
将选择移至下一个类别中的第一项:
将所选内容移至上一类别中的第一项:
将所选内容移至整个菜单中的第一项:
将所选内容移至整个菜单中的最后一项:
Your script opens the Spotlight menu. The keyboard shortcut for opening the Spotlight window is command + option + space...
UPDATE: Given your revised answer, I have composed a little script that should do what you want...
You can do one of the following things at [1]:
Open the top hit:
Move the selection to the first item in the next category:
Move the selection to the first item in the previous category:
Move the selection to the first item in the whole menu:
Move the selection to the last item in the whole menu:
简单地添加一个延迟。
或者为了万无一失:
Simple add a delay.
Or to foolproof this: