当我们点击电池图标时,有一个名为Show Percentage的按钮,如何使用代码启用按钮?谢谢。如何通过代码显示MacBook Pro上的电池电量百分比? (AppleScript,执行shell脚本等)
编辑:
所以,我发现了一种通过UI控制要做到这一点,但这并不是理想的,任何人吗?
进入系统偏好设置 - >安全&隐私 - >辅助检查脚本Editor.app
tell application "System Events" to tell process "SystemUIServer"
try
set bettaryIcon to first menu bar item of menu bar 1 whose description starts with "Battery"
click bettaryIcon
click (the first menu item of menu 1 of bettaryIcon whose name = "Show Percentage")
end try
end tell