dougscripts.com

November 22 2025 - 3:30 pm

Playlist XML Onloader

There came a time at my house when I had to get rid of a bunch of playlists. Like about 100. That I was very attached to. So I didn't really want to trash them. Instead, I exported each one as an XML file.

But wait! After exporting just three of them (click "File", click "Library", click "Export Playlist...", click "Save"), the first thing I did was assign a Command-E keyboard shortcut to the "Export Playlist..." menu item. Are you kidding? Of course I did.

Then it occurred to me that if I could only export one playlist at a time, what are the chances that I can only import them one at a time. Unfortunately, the chances are excellent for that.

So I wrote a really simple script that can choose a batch of exported playlist XML files—providing they are all in the same folder, like ~/Music/Export Playlist XMLs/ or something—and load them into the Music app.

try

set thePaths to (choose file with prompt "Choose one or more Playlist XML files:" of type {"xml"} with multiple selections allowed)

on error

return

end try

repeat with f in thePaths

tell application "Music"

try

add POSIX path of (f as text)

on error m

display dialog m with title "Music sez:" with icon 2

end try

end tell

end repeat

Click on the little script icon there to open this in your Script Editor and then save it as a "Script Bundle" named whatever you like, perhaps "Playlist XML Onloader". Save it in ~/Library/Music/Scripts/ so that it will appear in the Music app's "Script" menu.

Site contents © 2001 - 2025 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.