Using AppleScript to click radio buttons

You can click the radio buttons in more then one way.

After the tell application "System Preferences" block use a tell application "System Events" block, e.g.:

tell application "System Preferences"
    set the current pane to pane id "com.apple.preference.dock"
    activate
end tell

tell application "System Events"
   click radio button 1 of radio group 1 of window 1 of process "System Preferences"
end tell

In this first usage, radio button 1 is Left, radio button 2 is Bottom and radio button 3 is Right.

Or:

tell application "System Preferences"
    set the current pane to pane id "com.apple.preference.dock"
    activate
end tell

tell application "System Events"
   click radio button "Left" of radio group 1 of window "Dock" of process "System Preferences"
end tell

In this second usage, use Left, Bottom or Right directly and you can also use Dock in place of window 1. (The latter of which you could do in any of these examples.)

Or:

tell application "System Preferences"
    set the current pane to pane id "com.apple.preference.dock"
    activate
end tell

tell application "System Events"
    click (every radio button whose value of attribute "AXTitle" is "Left") of radio group 1 of window 1 of process "System Preferences"
end tell

In this third usage, use Left, Bottom or Right for the value of (every radio button whose value of attribute "AXTitle" is "?") where the ? is one of these values.

Note: These examples have been tested under OS X 10.11.6 and work as now edited. I added
of radio group 1 between radio button and window. For use in OS X 10.8.5 remove of radio group 1 from the code.