Catalina Music app - volume control

Hi Jason,

Andreas mentioned that you were able to successfully use AppleScript to control Catalina's Music app volume up/down. Is that correct? Are you able to share the script code, please?

Thanks,
Sunil

Here is how to get a volume slider for Music:
The script it should display (widget specific):

if application "Music" is running then
    tell application "Music"
        set itunesvolume to sound volume
    end tell
    set currentvolume to itunesvolume / 100
    return currentvolume
else
    return " "
end if
--code by @Caliguvara

The Apple Script that needs to be run as async:

on bttWidgetSliderMoved(sliderValue)
    if application "Music" is running then
        tell application "Music"
            try
                set the sound volume to sliderValue * 100
            end try
        end tell
    end if
end bttWidgetSliderMoved

@Jason (hope I identified the right one, I guess you have been the most wanted at the beginning of the thread :wink:)

Thanks, Caliguvara. Actually I was looking for an AppleScript to attach to a keyboard shortcut, so that I can adjust the Music app volume up and down. Is that possible?

Hi everyone, I'm trying to accomplish something similar: I want to have buttons for volume up/down only for the Music.app, but so far it's challenging. I've tried to create a touch bar button with the action to send a shortcut to a specific app, namely the Music.app and then just use cmd up and cmd down to control the volume. But if I hit the button, nothing happens.

Does someone have an advice for me?

PS: Just solved it with my first Apple Script myself – seems to work:

tell application "Music"
set sound volume to sound volume + 5
end tell

and

tell application "Music"
set sound volume to sound volume - 5
end tell

1 Like
Imprint | Privacy Policy