Bonus: Extend iTunes with AppleScripts

iTunes does a lot; some people say it does too much. As this book has shown, many of those features are easy to tame, but at times you may want to go even further.

If you use a Mac, you can take advantage of AppleScripts to extend iTunes. While looking at AppleScripts in depth would take another book of this length, in this bonus chapter I want to give you a taste of what AppleScripts can do for you, and tell you about some of my favorite AppleScripts.

Bonus Topics

What Are AppleScripts?

Where Do I Get AppleScripts?

What Can I Do with AppleScripts?

What If I Use Windows? How Can I Do All These Great Things?

What Are AppleScripts?

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, Photos, Safari, Mail, etc.) and third-party applications (Microsoft Office, Adobe Creative Suite, etc.) support AppleScript to some extent.

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

When you add AppleScripts to your user folder at ~/Library/iTunes/Scripts, they display in a Scripts menu in iTunes, and you can run them by choosing them. (If you don’t have that folder, you can create it when you add your first AppleScript.)

Where Do I Get AppleScripts?

There are two ways to get AppleScripts. The first is to roll your own, but, to be fair, this requires a good knowledge of programming. While Apple claimed—and still claims—that AppleScript is close to natural language, this isn’t exactly the case. (For more about the technical aspects of AppleScript, check out Apple’s AppleScript hub on their developer site.)

There’s an easier way to get AppleScripts for iTunes. Go to the Doug’s AppleScripts for iTunes Web site. Run by Doug Adams, AppleScript guru extraordinaire, this site is a compendium of scripts that he has written and that others have submitted. There are scripts for managing tracks and track info, working with artwork, dealing with playlists, con­trolling iTunes, importing and exporting information about your iTunes library and playlists, managing files, working with libraries, and much more. As of this writing, the site houses 465 scripts and a handful of applications that Doug has written.

What Can I Do with AppleScripts?

If I said “just about anything” I’d be exaggerating; but not by much. When you see exactly what AppleScripts can do with iTunes, you may be surprised. I use them most often for tagging files; copying, correcting, truncating or appending track names; searching for and replacing text; finding “missing” tracks in my library; and changing hidden preferences.

But the best way to understand what AppleScripts can do is to look at some concrete examples. Here are my top ten AppleScripts, with links to them on the Doug’s AppleScript for iTunes Web site:

  1. Remove n Characters from Front or Back: This script lets you remove extraneous characters from the beginning or end of a tag. You can do this for tags including Name, Album, Artist, and Composer. I use it often for classical music; many Name tags include the name of the composer before the name of the track, in this form: Schubert: Gute Nacht. For an album tagged like that, I remove the first ten characters, and keep just the name of the track.
  2. Copy Tag Info Tracks to Tracks: With this script, I copy, say, all the track names from a classical album and paste them on the tracks of another recording of the same work. It’s a real time saver. You can copy the name, artist, album, composer, genre, artwork, and even dynamic tags such as last played date and rating.
  3. Super Remove Dead Tracks: Have you ever moved files around and then found that some of your tracks show up with a ! in iTunes? These “dead tracks” mean that you removed the original files, but not their entries in your iTunes library. Find them and remove them easily.
  4. Tracks Without Artwork to Playlist (found in TrackSift 2): I’m a stickler for adding album art to my tracks, so I have visual reminders of my music. I used this script a lot when I was going through the process of adding artwork. It creates a playlist for all the tracks in your library that have no artwork so you can search for graphics and add them to your music.
  5. Albumize Selection: This script takes selected tracks and changes their track numbers so they make up an album. As an added bonus, you can also add a new album name with it. I use it with multi-disc albums, or with long classical works that span more than one album, to keep the numbering coherent.
  6. This Tag That Tag: This very useful script lets you swap tags from one tag to another. For example, you may want to move or copy your Composer tag to the Artist tag; or you may want to append or prepend the Composer or Artist tag to the Album tag. This script lets you do these operations with a few clicks.
  7. Multi-Item Edit: If you find the Info dialog in iTunes 12 confusing and want a more user-friendly experience, try Multi-Item Edit. This AppleScript applet lets you edit tags for multiple items in an interface that is similar to the tag editing interface in iTunes 11 and earlier.
  8. Search-Replace Tag Text: Use this to do a search-and-replace in the name, artist, album, composer, comments, genre, or grouping tags. You can fix, for example, spelling errors in names, or put terms in one language into another.
  9. Proper English Title Capitalization: Are you tired of track or album names with words like the, of, and, or, and a in caps? Use this script to put them in lowercase as they should be.
  10. Music Folder Files Not Added: This script searches your iTunes Media folder for items that are not in your iTunes Library. This can be useful in conjunction with Super Remove Dead Tracks (item 3 above), to find items that aren’t referenced correctly in iTunes and add them to your library.

What If I Use Windows? How Can I Do All These Great Things?

Sorry, you can’t. AppleScript is a Mac-only scripting language, and there’s no equivalent for Windows.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset