I found the command, but can I do it in AppleScript?
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}
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With