Reputation: 1
How can I click the "Roatation:" button?
Upvotes: 0
Views: 244
Reputation: 6092
tell application id "com.apple.systempreferences"
reveal pane id "com.apple.preference.displays"
activate -- This used to not be necessary
end tell
tell application id "com.apple.systemevents" to tell ¬
process "System Preferences" to tell window 1
tell (a reference to pop up button -1 of group 1)
my (wait for it)
perform action "AXShowMenu"
tell menu 1
my (wait for it)
pick menu item 1
end tell
end tell
end tell
tell application id "com.apple.systempreferences" to quit
to wait for UIElementRef
tell application id "com.apple.systemevents" to repeat 10 times
if the UIElementRef exists then return
delay 0.5
end repeat
error from UIElementRef
end wait
You can change the following line:
pick menu item 1
by replacing the index number 1
with whichever menu item number you require.
Upvotes: 1