1

I can export a single playlist from iTunes to m3u format easily enough, but is there any way to do it en masse? I have about 40 playlists and it's exceedingly tedious to do it for all of them one at a time. I know you can dump the entire library database if you're just switching between macs but I use these all over the place. That library file is megabytes and megabytes and while I could conceivably reconstruct my playlists from the xml plist it's not ideal.

1

Just using iTunes by itself, I do not know of a way to export multiple playlists at the same time, as one can only select one playlist in the Sidebar at a time.

Normally to export a playlist in iTunes one would, e.g., select the target playlist in the Sidebar and then click: File > Library > Export Playlist…

This then brings up a Save dialog box, e.g.:

enter image description here

To semi-automate the process I assigned a keyboard shortcut of ⌘E to the Export Playlist… in System Preferences > Keyboard > Shortcuts > App Shortcuts, as shown the image below.

This allows me to easily bring up the Save dialog box without having to navigate the menus, and I can then just use the keyboard to easily walk through saving one playlist after the other.

It's easy to get into a rhythm, select the first playlist, then ⌘E > enter > down-arrow > ⌘E > enter > down-arrow > etc.

enter image description here


To further semi-automate the process, you can use a bit of AppleScript in Script Editor.

Example AppleScript code:

activate application "iTunes"
delay 1
tell application "System Events"
    repeat 1 times
        keystroke "e" using command down
        delay 0.5
        key code 36 # return key
        delay 0.5
        key code 125 # down-arrow key   
        delay 0.5
    end repeat
end tell

Change repeat 1 times to the number of times you want it to repeat.

Then in iTunes select the first playlist on the Sidebar and then run the script from Script Editor.

This example AppleScript code assumes you've already once selected the Where: and Format: and will use the default names in the Save As:, none of which are the same, and there are no playlists currently at the Where: that would interfere with the limited example AppleScript code. Otherwise, additional coding will be necessary.

If you want to use the example AppleScript code without assigning a keyboard shortcut for the Export Playlist… command, then in place of keystroke "e" using command down use:

    click menu item "Export Playlist…" of ¬
        menu "Library" of ¬
        menu item "Library" of ¬
        menu "File" of ¬
        menu bar item "File" of ¬
        menu bar 1 of ¬
        application process "iTunes"

Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.

2
  • Keyboard shortcut idea is definitely helpful, that's way faster than using the trackpad. Jun 26 '20 at 13:22
  • 1
    @Jared Smith, I've added a bit of AppleScript to further semi-automate the process. Jun 26 '20 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .