这一点 AppleScript 有效。如果我打开了系统偏好设置声音面板,并在脚本编辑器应用程序中运行它,它会将音量更改为 50%。
tell application "System Events"
tell process "System Preferences"
set v to value of slider 0 of window 0
log v
set value of slider 0 of window 0 to 0.5
end tell
end tell
这试图成为同一件事,但失败了。谁知道怎么修它?
var se = Application("System Events");
var spp = se.processes["System Preferences"];
spp.windows[0].sliders[0].value = 0.5
var curr = spp.windows[0].sliders[0].value();
console.log("Current value: " + curr + " - " + typeof(curr));
最终将其设置为 0。似乎我只能将音量设置为 0 或 1。实际上,我正在尝试编写另一个应用程序的脚本,但这归结为问题。