Applescript显示Apple菜单栏项目 [英] Applescript to show Apple menu bar items

查看:269
本文介绍了Applescript显示Apple菜单栏项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆