Play playlist as part of a macro


I am trying to make a super-simple macro. I want it to close all apps, open a URL and play a playlist from Apple Music.

The issue is that Apple Music will not play a playlist in a macro that contains other actions. The action on its own works fine, as soon as I add more actions it will open Apple Music but won't start playing.
I tried also with Apple Script instead of the action in the macro. Same behaviour.

I am running Keyboard Maestro 9.0.5 on macOS 10.15.5

Thank you in advance for your help.

Deep Work.kmmacros (3.3 KB)

@goat - I'll give it a try.

Add the Activate a Specific Application action (Select Music) along with a 5 second pause and see if that works. What I think is happening is when the Music app opens, the Playlists take a moment to build.

Try it out and let us know.


Hello @kcwhat, thanks for your suggestion.

That was indeed the issue!

Even with 5 sec. it still did not start playing, but then I went in debug mode and noticed that waiting a little more actually did the trick. Might be cause my MacBook Pro is not the youngest anymore. So I've changed the pause to 10 sec. and that did it.


Glad it worked for you @goat. The Pause action is definitely your friend in many cases.

Take care,


If I'm just using the activate and the AppleScript actions. What is the best way to have this happen in the background? Meaning say I have a full screen safari, or another application. Just fires up the playlist without switching to Apple Music.

I answered my own question. I just had to put Activate last application directly under the activate music but before the AppleScript. I originally tried that at the bottom.

FWIW bringing Music to the front should not be necessary to play a playlist. (Activating it is, but that alone should not bring it to the front.)

I have a lot of Apple Music macros, and very few of them require activating the app. All of my play a playlist macros work 100% in the background.

Take this one for example: it builds a list of every single playlist you have in your library and presents them in a prompt with list action, allowing you to select one to play. Once you select it, the playlist starts without Music being brought to the front. (Note that Music will lauch (or activate) if not already running, but it will not be brought to the front.

24)[AS-AM] Play playlist- Using Prompt from List.kmmacros (6.7 KB)

Macro screenshot (click to expand/collapse)

Thanks it works great with just the apple script.

Do you know how to launch a radio station like your personal music station?

Yea that’s pretty easy to do. First, click the three dots at the bottom-right corner of the radio station...

Screenshot (click to expand/collapse)

Screen Shot 2022-10-03 at 20.47.23

Then click the Share menu...

Screenshot (click to expand/collapse)

Screen Shot 2022-10-03 at 20.47.32

Then click copy link...

Screenshot (click to expand/collapse)

Then use that link in the following AppleScript:

open location "LINK GOES HERE"

Wash, rinse and repeat for each radio station you want to play.

That works perfectly. Thanks.

1 Like

Happy to help!