Increase volume on mac using AppleScript?

后端 未结 1 529
鱼传尺愫
鱼传尺愫 2020-12-19 02:20

I found the command, but can I do it in AppleScript?

相关标签:
1条回答
  • 2020-12-19 02:37

    Yes, you can: use set volume output volume N, where N is an integer from 0 to 100. Since there are 16 squares in the volume interface, and 100/16 = 6.25, there's no direct map from squares to this number, but you'll be fine if you think about it as a percentage. There's also the ability to set the input volume with set volume input volume N, and the alert volume with set volume alert volume N; set volume output muted BOOL mutes the output if BOOL is true, and unmutes it if it's false. (Alternatively, set volume ... with output muted or set volume ... without output muted.) You can stack these if you want to set multiple things at once. As Adam Rosenfield says, there's also set volume R, which (according to my docs) takes a real number between 0 and 7; however, this is deprecated, and has a strange range; I'd just use set volume output volume instead. If you want to query the current volume, you can run get volume settings, which returns a record of the form {output volume:82, input volume:46, alert volume:100, output muted:false}.

    0 讨论(0)
提交回复
热议问题