Applescript显示Apple菜单栏项目 [英] Applescript to show Apple menu bar items
问题描述
我是Applescript新手.我想知道Applescript可以显示来自任意应用程序的Apple菜单栏项目(但原始应用程序应保留许多栏).
I am an Applescript newbie. I want to know Applescript to show the Apple menu bar items from an arbitrary application (but the many bar should remain for the orginal application).
我使用Finder作为一种虚拟应用程序尝试了以下脚本,但是没有用.
I tried the following script, using Finder as a kind of dummy app, but it did not work.
tell application "System Events"
tell process "Finder"
tell menu bar 1
click menu bar item "Apple"
end tell
end tell
end tell
任何人都可以帮忙吗?
PS-1:我想知道这一点,因为Control-F2将焦点移至菜单栏通常不起作用,如以下链接所示: https://apple.stackexchange.com/Questions/12723/control-f2-偶尔将焦点移至菜单栏仅工作
PS-1: I want to know this because Control-F2 to move focus to menu bar often does not work, as reported in the following link: https://apple.stackexchange.com/questions/12723/control-f2-move-focus-to-menu-bar-only-works-occasionally
PS-2:我尝试发布图片,但不允许发布.
PS-2: I tried to post an image, but not allowed.
推荐答案
process 1 where frontmost is true
获得最前面的过程:
tell application "System Events" to tell (process 1 where frontmost is true)
click menu bar item 1 of menu bar 1
end tell
单击菜单栏项在全屏窗口中不起作用.如果几分钟未使用系统事件,它将自动关闭,并且再次打开时会出现短暂延迟.
Clicking menu bar items doesn't work in full screen windows though. And if System Events is not used for a few minutes, it closes automatically, and there's a short delay when it's opened again.
这篇关于Applescript显示Apple菜单栏项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!