我需要编写 AppleScript,设置一些值以在新的系统设置 UI 中显示滚动条。
这是我想出的代码
tell application "System Settings"
activate
set current pane to pane id "com.apple.Appearance-Settings.extension"
end tell
delay 0.1
tell application "System Events" to tell application process "System Settings"
-- ...
end tell
我发现了 Accessibility Inspector 应用程序,您可以在其中查看任何应用程序中元素的层次结构。在它的帮助下,我编写了工作脚本:
tell application "System Settings"
activate
set current pane to pane id "com.apple.Appearance-Settings.extension"
end tell
delay 0.1
tell application "System Events" to tell application process "System Settings"
set frontmost to true
tell window 1
tell group 1
tell splitter group 1
tell group 2
tell group 1
tell scroll area 1
tell group 2
tell radio group 1
set targetUIElement to a reference to radio button 1
if targetUIElement exists then
click targetUIElement
end if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
tell button 1 to click
end tell
end tell