In Applescript, how can I get to the Help menu Search field, like Spotlight?

柔情痞子 提交于 2019-12-08 03:15:53

问题


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?


回答1:


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




回答2:


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


来源:https://stackoverflow.com/questions/69391/in-applescript-how-can-i-get-to-the-help-menu-search-field-like-spotlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!