I need to write AppleScript that sets some value to Show scroll bars in new System Settings UI.
Screenshot of what I want to change in result
Here's a code with which I did come up
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
I found Accessibility Inspector application in which you can view the hierarchy of elements in any app. With its help, I wrote the working script:
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