Copy Apple Music Link

I regularly share a link to the currently playing Apple Music song on Messages or Telegram and it was getting tedious to use the mouse to get the link. I couldn't find a way to get the link via AppleScript, so used Keyboard Maestro!

Copy Apple Music Link to Clipboard.kmmacros (5.2 KB)

1 Like

Here's a version of this using menu items rather than mouse clicks.

COPY APPLE MUSIC LINK.kmmacros (26.8 KB)

image

Thanks, However, I've just tried a selection of my common playlists and all the items on the Song menu are disabled even after selecting Controls -> Goto Current Song. e.g. The "Made for you" & Siri playlists and also the "stations" for a given artist or song.

The only reliable thing I could find was the Share -> Copy Link menu item off the context menu from the control showing the currently playing song at the top of the window.

Maybe I'm doing something wrong?

Update: Further investigation shows that the menu items in the Song menu are available if I'm playing one or my own playlists. So maybe all the menu items are disabled when playing a playlist that I don't "own"?

Well, to start, this is one way to do it in AppleScript:

tell application "Music"
	tell current track
		set the clipboard to "“" & name & "” by " & artist
	end tell
end tell

But Keyboard Maestro has tokens for extracting the current track name, album, and artist, so you could do this:

Keyboard Maestro is so deep, it's easy to miss some of its easiest-to-use features.

Current Track To Clipboard.kmmacros (1.5 KB)

3 Likes

Interesting...I've always used AppleScripts to get current song info, but I've also used Spotify for the last several years, just recently having switched to Apple Music. Do you know if those Keyboard Maestro tokens work with Spotify? I'm on my MacBook right now which doesn’t have Spotify otherwise I would test it myself...

The key thing is that I want the applemusic.com URL for the currently playing track. I couldn't find it in the AppleScript dictionary.

Sometimes my reading comprehension drops to zero. Sorry, you're way ahead of me.

3 Likes

It's irritating when that happens; I did it yesterday...  :sunglasses:

-ccs

3 Likes

It's incredibly irritating that the AppleScript dictionary hasn't been updated! I'm glad I solved it with Keyboard Maestro, but it does feel like easy automation for sharing a link would benefit a subscription service.

Hey Rob,

Apple has been irresponsible in managing, maintaining, and improving AppleScript support in their own apps for decades now, so this is no surprise (as unfortunate and disgusting as it is).

Hopefully ShortCuts will take off and make automation more popular on macOS. If so then Apple will (hopefully) devote more resources to doing it right and making it worth 3rd party developer's while to add automation to their apps.

Please do take the time to give Apple an earful:

Feedback - macOS - Apple

-Chris

1 Like

If you've made songs/albums a part of your library, the Copy Link item should be available.

I imagine that's why it doesn't work when playing a "station" for an artist or a song then. Sometimes, it's really clear that Music.app's roots are very much from back in the old days of owning your own music, before the Apple Music subscription service was invented.

1 Like