applescript 如何引用容器中的对象
applescript how to reference objects in containers
我想在 OS X 上使用终端和 osascript
命令将当前系统音量降低 10%。
我正在这样做:
osascript -e 'get volume settings'
打印:
output volume:38, input volume:100, alert volume:100, output muted:false
然后我想这样做:
osascript -e 'set volume 38 - (38 * 0.1)'
我试过这个:
osascript -e 'first item of (get volume settings)'
但是我得到这个错误:
0:10: execution error: Can’t get item 1 of {output volume:14, input volume:100, alert volume:100, output muted:false}. (-1728)
有什么想法吗?
设置输出音量的语法有点特殊
osascript -e 'set volume output volume 38'
要将输出量减少 10%,请使用
osascript -e 'set volume output volume (get (output volume of (get volume settings)) * 0.9)'
我想在 OS X 上使用终端和 osascript
命令将当前系统音量降低 10%。
我正在这样做:
osascript -e 'get volume settings'
打印:
output volume:38, input volume:100, alert volume:100, output muted:false
然后我想这样做:
osascript -e 'set volume 38 - (38 * 0.1)'
我试过这个:
osascript -e 'first item of (get volume settings)'
但是我得到这个错误:
0:10: execution error: Can’t get item 1 of {output volume:14, input volume:100, alert volume:100, output muted:false}. (-1728)
有什么想法吗?
设置输出音量的语法有点特殊
osascript -e 'set volume output volume 38'
要将输出量减少 10%,请使用
osascript -e 'set volume output volume (get (output volume of (get volume settings)) * 0.9)'