Mute Mac Volume

Posted on
Tue Jun 11, 2019 11:19 pm
koburg offline
Posts: 167
Joined: Jul 27, 2017

Mute Mac Volume

I want to make a Schedule to turn the volume for the Mac running indigodomo down (MUTE) is there any way to do this ?

have tried searching the forum no luck so far.

Posted on
Tue Jun 11, 2019 11:39 pm
koburg offline
Posts: 167
Joined: Jul 27, 2017

Re: Mute Mac Volume

thanks but also want to know how to do it in python

because of what yourself mentioned.

Posted on
Wed Nov 17, 2021 5:28 pm
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Mute Mac Volume

I have the same need. Anybody find a way to do this?

John R Patrick
Author of
Home Attitude

Posted on
Thu Nov 18, 2021 8:04 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: Mute Mac Volume

You can do this with a simple external AppleScript (sorry):

Code: Select all
tell application "Finder" to set volume 0


Or via a more complex way:
https://dev.to/kojikanao/control-mac-so ... python-h4g

BTW: we are using Airfoil and the Indigo Airfoil plugin to control all the speakers/volume through the whole house, works perfect.

John

Posted on
Thu Nov 18, 2021 3:32 pm
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Mute Mac Volume

I don't see how Finder can change the Mac volume. Also, I don't want to use an AppleScript. The other solution you describe may be just what I have been looking for. What I am trying to do is mute my Mac from an action group. I tried to install osascript but it did not work. Also, does osascript support python?

John R Patrick
Author of
Home Attitude

Posted on
Tue Nov 30, 2021 10:45 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Mute Mac Volume

There is no built-in way for Python to do this. osascript is also a command line utility that's installed with macOS, and that's probably the best bet. You can call it from python:

Code: Select all
import os
os.system("/usr/bin/osascript -e 'tell application \"Finder\" to set volume 0'")

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Dec 04, 2021 2:11 pm
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Mute Mac Volume

This solution works perfectly in my Python script. The question I have is how does it work? I am not aware of any actions I can take with Finder to change system volume. Is it a hidden command?

John R Patrick
Author of
Home Attitude

Posted on
Sat Dec 04, 2021 2:13 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Mute Mac Volume

The Finder is just the app that's providing the interface for scripting for the sound system. AppleScript targets apps, so they had to put it somewhere. It does the same things as the volume control keys.

Also, there are menu bar controls for volume. What app is that?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed May 04, 2022 2:29 pm
rustyhodge offline
Posts: 54
Joined: Nov 11, 2016

Re: Mute Mac Volume

All you actually need is:
Code: Select all
import os
os.system("/usr/bin/osascript -e 'set volume 0'")

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests