"Sound is not running for specific time" trigger?

I like this method. You could perhaps simplify the subroutine by running your if/else/then via bash.

audioOutput=$(pmset -g | sed -En "/^ sleep /p" | grep -o "coreaudiod")
if [[ $audioOutput == *"coreaudiod"* ]]; then
  echo "1"
	  else
  echo "0"
fi

That will return 1 for audio outputting or 0 for no audio output. Your subroutine could then be as follows:

Subroutine Screenshot (click to expand/collapse)

You also don’t really need the macIsOutputtingSound variable parameter under the trigger, unless you need to pass information to the subroutine for processing before execution. Removing that will remove the variable field in the execute a subroutine action as seen below:

Actions Screenshot (click to expand/collapse)

3 Likes