Applescript for specific System Preferences pane

Solution 1:

Here's a script I just wrote that'll do it. This will get you to the shortcuts tab of the Keyboard preference pane, and select a row from the left and right columns:

tell application "System Preferences"
    activate
    reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
tell application "System Events"
    tell application process "System Preferences"
        repeat until (window 1 exists)
        end repeat
        tell window 1
            #modify these to specify a row in the left column, or the right column, respectively
            
            repeat until (row 3 of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)
            end repeat

            select row 3 of table 1 of scroll area 1 of splitter group 1 of tab group 1
            
            repeat until (row 1 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 exists)
            end repeat

            select row 1 of outline 1 of scroll area 2 of splitter group 1 of tab group 1
        end tell
    end tell
end tell

Here's the version you can use which identifies the rows by name. Sort of hacky, but it should work well.

tell application "System Preferences"
    activate
    reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
tell application "System Events"
    tell application process "System Preferences"
        repeat until (window 1 exists)
        end repeat
        tell window 1
            #modify these to specify a row in the left column, or the right column, respectively
        
            repeat until (rows of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)
            end repeat
        
            select (first row of table 1 of scroll area 1 of splitter group 1 of tab group 1 whose value of static text 1 is equal to "Services")
        
            repeat until (rows of outline 1 of scroll area 2 of splitter group 1 of tab group 1 exists)
            end repeat
        
            select (first row of outline 1 of scroll area 2 of splitter group 1 of tab group 1 whose name of UI element 2 is equal to "Open URL")
        end tell
    end tell
end tell