set a track illustration in music using apple script

I can do this using automator but it consists of a bunch of mouse clicks that takes for ever to execute.

There must be a much more straight forward way of doing this using a few lines of apple script.

I'm pretty knowledgeable in apple script but struggling to find the "handles" to set the illustration property of a track.

my code/pseudo code would look like this:

tell application "Music"

set the illustration of the selected track(s) to <path name>

end tell


thanks





Mac Studio, macOS 15.5

Posted on Jul 14, 2025 11:29 AM

Reply
4 replies

Jul 23, 2025 10:02 AM in response to gtmaz

I have had moderate success using AI (about the only thing I do with AI) to make a starter for Applescripts for Music. In Google I did a search for: Applescript to set the track images to a chosen file It returned something that appeared to be viable but I didn't test it.


Note that I say moderate success. I think it is patching together bits and pieces from various sources, including some that may have code that is outdated. You sound like you're at about the level I am at with Applescript so hopefully this will provide a starter for you. I have made various scripts starting with an AI generated one, but almost always have to do a fair bit of modification.


I also note you use the term "illustration", but that does not sound to me like what Apple would call it which would more likely be "artwork".

Jul 23, 2025 10:15 AM in response to gtmaz

I'm not sure of the exact code to embed an artwork image from a given file path either. I've looked at the Apple Music library in the Script Editor, but it isn't exactly clear. A tag can potentially store multiple images, so the Artwork property of a track is a collection. I don't see a function to assign an image from a file path, but one might nonetheless exist. I can do it in Windows.


See also https://dougscripts.com/itunes/scripts/scripts13.php which is a collection of scripts that manage artwork. Perhaps one there already does what you need.


tt2

Jul 23, 2025 01:10 PM in response to turingtest2

I've been trying to do something related, namely copy artwork from a web image and then paste it to a track. Music's way of doing this (vs. iTunes 7 where it was simple) is clumsy and unreliable. You have to open up multiple windows and tabs, and then once I have pasted it, the artwork does not show in the side panel of a playlist window. It is definitely there if viewed in the Artwork tab. Definitely a Music bug. (There; after all these years I have accused Apple of having a bug!)


I tried various suggestions made by AI but they all pop up various errors such as can't make data into expected type and <<class>> errors.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

set a track illustration in music using apple script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.