Click a tab item in system settings using AppleScript in Automator?
You can use the AppleScript command from the System Preferences application instead of the GUI scripting

tell application "System Preferences"
    -- open the audio pane and select the "Audio in" tab
    reveal anchor "input" of pane id "com.apple.preference.sound"
    activate
end tell

tell application "System Events" to tell process "Systeminställningar"
    -- do something in "Ljud in" tab
end tell