Using AppleScripts with iTunes

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

AppleScript-icon.pngI write a lot about using AppleScripts with iTunes. Thanks to iTunes’ scriptability, it is possible to extend the app with numerous features and shortcuts. If not for Doug Adams, the master scripter and proprietor of Doug’s AppleScripts for iTunes, I would spend a lot more time managing my iTunes library.

I often mention AppleScripts in my Ask the iTunes Guy column over at Macworld, since Doug’s scripts make a lot of seemingly complicated maneuvers a matter of a few mouse clicks. In this week’s column, which I just finished writing, I mention two AppleScripts, and I thought it would be useful to talk a bit about AppleScript and discuss how you use AppleScripts with iTunes.

AppleScript is a scripting language that Apple developed for the Macintosh operating system in the early 1990s. It was first available on System 7.1.1, and it offers a way to take advantage of system functions via AppleScripts, short programs that are much easier to write than full-fledged applications.

AppleScript works with much more than just the operating system: many Apple programs (the Finder, iTunes, iPhoto, Safari, Mail, etc.) and third-party applications (Microsoft Office, Adobe Creative Suite, etc.) support AppleScript to some extent. But none more than iTunes.

AppleScript support can be limited—supporting a mere handful of commands—to complex. iTunes is one of those programs that offers in-depth scriptability, notably by providing access via AppleScript to the tags in your media files.

When you add AppleScripts to your ~/Library/iTunes/Scripts folder (that’s the Library folder in your home folder, the one with your house icon and your user name), they display in a Scripts menu in iTunes, and you can run them by choosing them. To access this folder, in the Finder, press the Option key, choose the Go menu, then choose Library. Next, find the iTunes folder there, and open it. If you have any AppleScripts, you’ll have a Scripts folder; if not, you’ll need to create one.

When you download any AppleScripts from Doug’s site, you place them in the above folder. Once they are in that folder, iTunes sees them. You’ll see a script icon in the menu bar, right before the Help menu.


For some scripts, you select one or more tracks; for others, you select a playlist. After you’ve selected the items the script is to run on, you click the scroll icon and select the script’s name.

That’s all there is to it. Make sure to check out Doug’s AppleScripts for iTunes to see what you can do with AppleScript, and don’t forget to donate to Doug Adams, who’s written hundreds of AppleScripts to help make iTunes better.

3 replies
  1. Mark Rabnett says:

    I have really benefited from Doug Adams’ excellent scripts. One of my favourites is the elegantly simple script “Just Play This One.” Using the keyboard shortcut Command-1, I can play just one selected track in an iTunes playlist and then have it stop automatically. I frequently want to listen to music in this way, but iTunes is determined to move on to the next track. Yes, I could create separate playlists for individual works, but imagine the effort involved in doing this for a playlist containing a big set of, say, Haydn’s 104 symphonies or Bach’s Cantatas.

    Unfortunately I have not been able to find a similar script that will “just play” two or more selected tracks in succession. Since so many classical works are made up of distinct movements, such a script would make it more pleasurable to sit back and relish a complete performance of a piece as it was meant to be played. One of these days I hope to see a “Just Play THESE” script on Doug Adams’ site.

      • Mark Rabnett says:

        Many thanks for this very helpful reply. I was not aware of the Shift-Command-N trick in iTunes. I like your script better since it places the playlist outside of any folders. I applied the keyboard shortcut to the script, as you suggest. A good solution.

        Yes, I still have to delete playlists created with the script, but I can live with that. It can actually be helpful to keep them around for a while. For example, I might want to review what I listened to at the end of the day. So I can simply name the new playlists Today1, Today2, etc.

        This may seem to be a minor matter, but to me it makes a big difference in getting the most out of iTunes. Thanks again.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply