I'm trying to create an AppleScript for setting the value of Input Volume of the Input category under the Sound menu in System Preferences.
How does one change the value of a Slider?
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
end tell
tell application "System Events"
if UI elements enabled then
try
tell application process "System Preferences"
tell tab group 1 of window "Sound"
click radio button "Input"
select row 1 of table 1 of scroll area 1
set selected of row 1 of table 1 of scroll area 1 to true
set deviceselected to "Microphone"
set slider "Input Volume" of group "Input Volume" of tab group "Input" to 0
select row 2 of table 1 of scroll area 1
set selected of row 2 of table 1 of scroll area 1 to true
set deviceselected to "Microphone"
set slider "Input Volume" of group "Input Volume" of tab group "Input" to 0
end tell
end tell
end try
end if
end tell
This doesn't seem to work. I also tried using Accessibility Inspector to find out how to hierarchically access the elements in the following manner,
value of slider of group "Input volume" of tab group "Input" of window "Sound"
That doesn't seem to be a correct way either.
What's wrong here?
EDIT
set content of slider "Input volume" of tab group "Input" of window "Sound" of tab group 1 of window "Sound" of application process "System Preferences" to 0
--> error number -1700 from content of slider "Input volume" of tab group "Input" of window "Sound" of tab group 1 of window "Sound" of application **
So it returns an error. I couldn't find any description for error code -1700, what does it mean?