Привет, я пытаюсь написать сценарий Apple для поворота дисплеев в macOS 12.3.
Я просмотрел приведенное ниже, однако Apple изменила меню отображения.
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
любезно предоставлено комментарием oluckyman к это суть
tell sheet 1
select row 2 of outline 1 of scroll area 1 -- the row with external monitor
tell pop up button "Rotation:"
set theRotation to value of it
click
tell menu "Rotation:"
if theRotation = "Standard" then
click menu item "90°" -- your preferred rotation
else
click menu item "Standard"
end if
end tell
end tell
delay 1
if exists of button "Confirm" of sheet 1 then
click button "Confirm" of sheet 1
end if
click button "Done"
end tell
https://gist.github.com/v1c77/96affa87de94045d29cdc5f9cb8c1847