繁体   English   中英

applescript如何引用容器中的对象

[英]applescript how to reference objects in containers

我想使用Terminal和osascript命令在OS X上将当前系统音频音量降低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)'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM