Inspired by Paul Stamatiou’s post on a Finder plugin to restart Firefox, I decided to tackle a long standing personal issue with iTunes and last.fm.
For those not in the know, last.fm is in essence a music tracking program; any song you play in your iTunes gets sent to the last.fm site, where you can browse your personal music charts, get recommendations, and find people with similar musical tastes. It’s a very powerful program, but one issue has constantly annoyed me. If you don’t have the last.fm program open, it, obviously, cannot record what songs you listen to.
When last.fm first came out, it acted as a plugin for iTunes, so you did not have to remember to start both programs. Alas, the new (more powerful) version of last.fm is a standalone program, so if you forget to start iTunes and last.fm at the same time, your music does not get “scrobbled” (according to last.fm, “Scrobbling a song means that when you listen to it, the name of the song is sent to Last.fm and added to your music profile”).
The fix is really simple, and like Paul’s plugin for Firefox and Jono’s plugin for Quicksilver, only requires two lines of code.
First, fire up Apple’s Automator.
Then, find and drag the “Run Shell Script” command to the right pane.
Next, add these two lines:
I’d also recommend checking off the “Show Action When Run” box under Options, so you don’t have a terminal window pop up every-time you start iTunes.
Your Automator window should look something like this:
Now, save your workflow as an Application. In the next step, we’ll replace iTunes with our new application in the dock.
As you can see, I named the app iTunes w/ last.fm and saved it in the Applications folder. Whatever you named it and wherever you saved it, find the application, select it and hit Command I (or click “Get Info” in the menubar) to get to the info window for the newly created app. As you can see, the icon for the app is the little Automator robot, but as I replaced iTunes in my dock with this application, I also updated the icon with the iTunes logo.
To change the icon, go to the info window for iTunes, select the small iTunes icon at the top of the window, and hit Command C to copy the icon. Now go back to the iTunes w/ last.fm app (or whatever you called it), select the small Automator icon at the top of the window and hit Command V to paste the iTunes icon.
To finish up, I removed the iTunes and last.fm apps from my dock and dragged the iTunes w/ last.fm to the dock. Now, whenever I click the iTunes icon, both last.fm and iTunes open, ensuring my songs will always get scrobbled!
iTunes w/ last.fm app in the Dock
Not only will last.fm open whenever you open iTunes (from the dock), but you’ll never have to update the app as it just opens iTunes and last.fm. Now, if anyone knows how to tweak the code so the last.fm window will hide itself once opened, let me know.