How To Enhance iTunes with AppleScript
Many people would agree that iTunes is fast becoming (or has already become) bloatware. It has a ridiculous number of features and uses, but not always what we'd consider to be the right ones. You can find out what songs Bruno Mars is particularly enjoying at this time, and yet can’t search YouTube for music videos.
Luckily, everybody’s in the same boat, and people have been working tirelessly to create ways for you to make your iTunes work the way you want it to. Today, we’ll be focusing on DougScripts, a site started by Doug Adams a little over 10 years ago in February 2001, which is home to around 500 AppleScript files.
These scripts are free to download and easy to install. In this article, we’ll be showing you how to do just that, and showcasing some of Doug’s best work over the past 10 years.
Installing a Script
Installing an AppleScript script is just about as easy as you can get. If you want to follow along with this short tutorial, we’ll be working with Just Play This One, a script which plays a selected song in iTunes, instead of the whole album or playlist.
- Download the script, and uncompress the ZIP file.
- Open up the DMG. In this case, you will have all of the instructions laid out for you already, but if you download scripts from other sites, you are not always so lucky.
- Open up a second Finder window, and navigate to (your username)/Library/iTunes/Scripts. If you haven’t got a “Scripts” folder, which is likely, if you’ve never installed a script before, simply make one.
- Drag Just Play This One.scptd into your Scripts folder. You can put the instruction file in too, but it’s not necessary for the script to work.
Installing the Script
Running a Script
- Bring up iTunes. There is no need to quit and reopen iTunes, the script will be loaded automatically.
- In the case of the “Just Play This One” script, select a song from an album or playlist, go into the AppleScript menu (A scroll icon in the menu bar), and click “Just Play This One”. iTunes will play the selected song and stop.
Running a Script
Every script is different, so you will use them differently. Check the instructions that come with the script on how to use the individual script. One thing which stays the same is that you run the script from the AppleScript menu.
Assigning a Keyboard Shortcut
Having to go through the menu bar every time you want to activate one of these scripts is time-consuming. Wouldn’t it much easier to use a keyboard shortcut? Here’s how:
- Take note of the exact wording of the command in the menu bar you want to add a shortcut to. All punctuation, capitals, etc. are essential for it to work.
- Close iTunes.
- Open System Preferences, and navigate to the Keyboard panel. Then, go to the Keyboard Shortcuts tab.
- Click on the “+” button and a panel will pop up.
Setting a Keyboard Shortcut
- Select iTunes as the application.
- Type the exact command into the “Menu Title” field. In this example “Just Play This One”.
- Choose your keyboard shortcut. Try not to make it anything that will conflict with other shortcuts.
- Open iTunes again and use your shortcut at will.
20+ Great Scripts to Improve iTunes
Now that you know how to install and use scripts, it’s time to start building your script library. Here are over 20 of the most useful scripts from Doug Adams.
Super Remove Dead Tracks
“Dead tracks” are those in which the file is no longer locatable, and can be identified in iTunes by a “!” next to their name. This scripts gets rid of them from your library in one fell swoop.
Delete Tracks Never Played
Everybody has a number of songs with a play count of 0 which they have never listened to. Maybe, eventually, you’ll conclude that if you haven’t listened to it yet, you probably never will, and want to delete them. This script does it easily.
Import iPod Audio Files
If you somehow lose some songs from iTunes, but have them on your iPod, you can use this script to recover them. This won’t work for your entire library, but it should be able to handle an album or two.
Update Expired Podcasts
If you haven’t listened to a podcast for a certain length of time, iTunes will stop downloading updates. Use this script to update them again.
Change iTunes Hidden Preferences
There are a number of iTunes preferences which Apple have decided to hide, but you can access them with this script. You’ll be able to hide the Ping buttons, use half stars for ratings, and several more.
Change iTunes Hidden Preferences
Gather Up the One-Hits
This script creates a playlist of the artists of which you only have one song by. Often, these songs are crackers, so this is a very useful script.
This can be used to play a certain length of every song before skipping to the next. If you have a low attention span, this could be for you.
This app creates playlist of random songs, but in blocks of 2 or 3 songs by each artist. So you’ll get 2 songs by The Beatles, then 2 by Queen, 2 by Bowie, and so on.
Just Play This One
This is the script from our tutorial. As previously explained, it plays a single song and then stops, instead of a whole album or playlist.
Play Selected Track Next
This is a nice way to queue up a track. Simply select it while another track is playing, and run the script. The selected track will play after the current song has ended.
Now Where Was I?
This script remembers the song you played when you quit iTunes, and starts playing it again when you open iTunes again. It requires a little more work to get its full function, but it’s very useful if you put in the little bit of extra time.
Tracks Without Artwork to Playlist
This does exactly what it says on the tin - Places all tracks without any artwork into a playlist so you can work through them in your own time.
Remove n Characters from Front or Back
Sometimes, all tracks in an album will be named something along the lines of “07 - The Beatles - A Hard Day’s Night”. With this script, you can remove a certain number of characters from the front or back of a track name, in order to clean it up.
New Play Count
I like my play count to be an accurate representation of my favourite songs (it rarely is), and this script can assign new play counts to songs, if you had to re-import a song, or if you just wanted to hide how many times you’ve listened to that Hannah Montana soundtrack.
New Play Count
Rate Me! Rate Me!
This script reminds you to rate a song, whenever an unrated song is played. If you’re not in the habit of rating songs, this is a great way to start.
Sundry Info to Comments
What do you put in the Comments field in iTunes? If you’re like me, you won’t have much to put in there. This script allows you to put the file name, file path, sound volume, file creation date or a number of other details in the comments field.
Album to Album Artist
In most cases, except compilation albums, the artist field will read the same as the album artist field. With the script, you can quickly synchronise the two fields.
Proper English Title Capitalisation
If you’re anything like me, you want every little meta tag to be perfect, and poorly capitalised song titles will drive you to despair. This script will save you from a lifetime of frustration.
No prizes for guessing what this does - It searches Wikipedia for the song, album, artist or composer of a selected song. Great for getting data for meta tags quickly.
This too is pretty self-explanatory - It searches YouTube for the selected song. If you love music videos, this will be an essential download.
Guitar Tab Search
Can you guess what this script does? Yup, it finds guitar tabs on Ultimate Guitar for a selected song. How did you guess?
This is less useful, more fun. It plays a snippet of a song, and you must guess the song.
As you can see, there are plenty of excellent scripts available, and that’s just on one website. Start exploring more websites and you’ll never need to manually edit a thing on iTunes ever again.
Considering how easy it is to install these scripts, and how much time they save, there’s no reason why you shouldn’t get started straight away!