【发布时间】:2011-09-03 20:14:52
【问题描述】:
我正在尝试创建一个 AppleScript 来设置 声音 菜单下 Input 类别的 Input Volume 的值>系统偏好设置。
如何改变 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
这似乎不起作用。 我还尝试使用 Accessibility Inspector 来了解如何以以下方式分层访问元素,
value of slider of group "Input volume" of tab group "Input" of window "Sound"
这似乎也不是正确的方法。
这里有什么问题?
编辑
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 **
所以它返回一个错误。我找不到错误代码-1700的任何描述,这是什么意思?
【问题讨论】:
标签: macos scripting applescript