I'm tring to select "Soundflower (2ch)" as my audio output using this script:
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.sound"
get the name of every anchor of pane id "com.apple.preference.sound"
reveal anchor "output" of current pane
select (row 1 of table 1 of scroll area 1 of tab group 2 current pane)
end tell
It gives the error :
Syntax Error: Expected "," but found number
for "row 1"
What is the correct format?
I also tried:
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.sound"
get the name of every anchor of pane id "com.apple.preference.sound"
reveal anchor "output" of current pane
select (row, 1 of table, 1 of "scroll area", 1 of "tab group", 2 of current pane)
end tell
but got
Syntax Error: Can’t get 1 of table. Access not allowed.
How do I do this?
Try:
tell application "System Preferences"
activate
set myPane to pane id "com.apple.preference.sound"
set the current pane to myPane
tell myPane
name of every anchor -- {"output", "input", "effects"}
reveal anchor "output"
end tell
end tell
-- Use this script as a wrapper for GUI Scripting statements when you are confident that GUI Scripting is available and enabled or that the user knows how to enable it if necessary
activate application "System Preferences"
tell application "System Events"
tell process "System Preferences"
select row 1 of table 1 of scroll area 1 of tab group 1 of window 1
end tell
end tell