苹果脚本旋转显示
您好,我正在尝试编写一个苹果脚本来在 macOS 12.3 中旋转显示器,
我已经查看了以下内容,但是苹果已经更改了显示菜单
https://apple.stackexchange.com/questions/319938/keyboard-shortcut-flip-screen
外部显示器选择单元格菜单项时遇到问题
我在为我尝试使用的 辅助功能检查器,但我不知道如何让它工作
if running of application "System Preferences" then
quit application "System Preferences"
delay 1
end if
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
delay 1
tell application "System Events"
tell process "System Preferences"
tell window 1
click button "Display Settings…"
tell cell of outline row of outline 1 of scroll area 1 of sheet 1 of window 1
set selected to false
end tell
--tell pop up button "Rotation:" of tab group 1 of (first window whose name is "LG HDR 4K") of application process "System Preferences"
-- if (value) contains "Standard" then
-- click
-- click menu item "90°" of menu 1
-- my clickConfirmButton()
-- else
-- click
-- click menu item "Standard" of menu 1
-- end if
-- end tell
end tell
end tell
end tell
end tell
Hi I am trying to write an apple script to rotate displays in macOS 12.3
I have reviewed the below however apple has changed the display menu
https://apple.stackexchange.com/questions/319938/keyboard-shortcut-flip-screen
I am having trouble selecting the cell menu item for an external display
I have tried using Accessibility Inspector, but I don't know enough to get it to work
if running of application "System Preferences" then
quit application "System Preferences"
delay 1
end if
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
delay 1
tell application "System Events"
tell process "System Preferences"
tell window 1
click button "Display Settings…"
tell cell of outline row of outline 1 of scroll area 1 of sheet 1 of window 1
set selected to false
end tell
--tell pop up button "Rotation:" of tab group 1 of (first window whose name is "LG HDR 4K") of application process "System Preferences"
-- if (value) contains "Standard" then
-- click
-- click menu item "90°" of menu 1
-- my clickConfirmButton()
-- else
-- click
-- click menu item "Standard" of menu 1
-- end if
-- end tell
end tell
end tell
end tell
end tell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢 oluckyman 对 此要点
https://gist.github.com/v1c77/96affa87de94045d29cdc5f9cb8c1847
courtesy of oluckyman's comment on this gist
https://gist.github.com/v1c77/96affa87de94045d29cdc5f9cb8c1847