Estoy intentando cambiar la configuración de escala de mi MacBook Pro 14" mediante AppleScript.
El ajuste debe alternar dos ajustes de resolución.
He encontrado el siguiente script aquí: https://stackoverflow.com/a/62664159/15705553
on run {input, parameters}
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
set lowResolutionSettingIndex to 4
set highResolutionSettingIndex to 5
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
click radio button "Display" of tab group 1
click radio button "Scaled" of tab group 1
tell radio group 1 of group 1 of tab group 1
set isHighResolutionSet to get value of radio button highResolutionSettingIndex
end tell
if isHighResolutionSet then
-- Toggle native resolution
click radio button lowResolutionSettingIndex of radio group 1 of group 1 of tab group 1
else
-- Toggle Default setting - "Retina optimized"
click radio button highResolutionSettingIndex of radio group 1 of group 1 of tab group 1
end if
end tell
quit application "System Preferences"
return input
end run
He cambiado "Pantalla Retina incorporada" por "Pantalla Retina líquida XDR incorporada" como se muestra en mis Preferencias del Sistema, pero se producen dos errores:
-
Si ejecuto este script a través de Automator, obtengo el siguiente error:
Syntax Error: System Events got an error: Can’t get window "Built-in Liquid Retina XDR Display" of process "System Preferences".
-
Si lo ejecuto a través de shortcuts.app, obtengo el siguiente error, a pesar de que he concedido acceso a las funciones de accesibilidad para Shortcuts en las Preferencias del Sistema
System Events got an error: Shortcuts is not allowed assistive access.