Extend the Music and TV Apps with AppleScripts

You can take advantage of AppleScripts to extend the functionality of the Music and TV apps. 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.

Introducing AppleScripts

AppleScripts are short, simple programs that are much easier to write than full-fledged applications and that let you act on files and metadata in many Apple apps (the Finder, Music, TV, Photos, Safari, Mail, etc.), as well as a number of third-party applications (Microsoft Office, Adobe Creative Suite, etc.) that provide some AppleScript support.

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

When you add AppleScripts to your user folders at ~/Library/Music/Scriptsand~/Library/Apple TV/Scripts, they display in Scripts menus respectively in the Music and TV apps, and you can run them by choosing them from those menus. You must create these folders if you want to use AppleScripts. Also note that you may want to use the same scripts with both apps; you must add copies of the script to both folders, in this case.

Where to Find 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.

There’s an easier way to get AppleScripts for the Music and TV apps. Go to the Doug’s AppleScripts website. Run by Doug Adams, AppleScript guru extraordinaire, this site is a compendium of scripts that he has written. There are scripts for managing tracks and track info, working with artwork, dealing with playlists, controlling the Music and TV apps, importing and exporting information about your Music and TV libraries and playlists, managing files, working with libraries, and much more. The site houses hundreds of scripts and a handful of applications that Doug has written.

What You Can Do with AppleScripts

When you see exactly what AppleScripts can do with the Music and TV apps, 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 AppleScripts website:

  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 10 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 missing track icon in the Music app? These “dead tracks” mean that you removed the original files, but not their entries in your Music 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 the Music and TV apps confusing and want a more user-friendly experience, try Multi-Item Edit. This AppleScript applet lets you edit tags for multiple items in a user-friendly interface.

  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 Music Media folders for items that are not in your Library. This can be useful in conjunction with Super Remove Dead Tracks (item 3 above), to find items that aren’t referenced correctly in the Music and add them to your library.

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

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