I'm trying to do some GUI scripting with AppleScript but every time I try to use the click command, it will work but cause an error. If I use a try
statement it works fine, but I shouldn't have to do that. Here's some code that I started to turn on Speakable Items:
tell application "System Preferences"
set current pane to pane id "com.apple.preference.universalaccess"
reveal anchor "SpeakableItems" of current pane
end tell
tell application "System Events"
click radio button "On" of radio group of tab group 1 of window 1 of application process "System Preferences"
end tell
The 'On' radio button gets clicked, but I get this error aswell:
error "System Events got an error: radio button \"On\" of radio group of tab group 1 of window 1 of application process \"System Preferences\" doesn’t understand the “click” message." number -1708 from radio button "On" of radio group of tab group 1 of window 1 of application process "System Preferences"
Can someone tell me what I'm doing wrong?
Best Answer
It seems that even though the UI Element shows up as
radio group
in 'Result', you need to specifyradio group 1
for the click command to work.