Message
back to the journal

Using Quicksilver to control Last.fm

August 7th, 2009

Quicksilver & Last.fm

For a while, I’ve been using handy Quicksilver triggers to control iTunes. I like not needing to switch my attention from what I’m working on, in order to skip a track, pause the playback, set a rating or whatever. You can find out how to create a trigger from one of the many great Quicksilver tutorials out on the Web.

At the moment though, I find myself listening to Last.fm more and more, and have been looking for a similar way to control the Last.fm application. I couldn’t find a plugin for Quicksilver to achieve this so I set about writing an Applescript which I could trigger with Quicksilver.

I’m not much of an Applescript whizz, but I managed to put the following script together to skip the track currently playing in the Last.fm application:

tell application "Last.fm" to activate
tell application "System Events"
	tell process "Last.fm"
		click menu item "Skip" of menu "Controls" of menu bar 1
	end tell
end tell

After saving this in a suitable location (I have a Utils folder where I keep lots of scripts and utilities), I set a Quicksilver trigger to run the script. Simple!

Happy with the result, I created similar scripts for some other controls like love, ban, play and stop and assigned them all keyboard triggers.

My only wish was that I could do this without giving Last.fm focus. Generally this is fine for my because I have it running in a second display, so it doesn’t steal my attention, but it would be nice if I could get Applescript to execute the command without activating the application. I’d welcome suggestions from anyone with more Applescript fu than me.

3 Responses to “Using Quicksilver to control Last.fm”

  1. 3stripe,

    So what is the scrip to Love a track then?!

    Cheers :)

  2. gossnj,

    Here is a slight modification that will save your current focus application and then return you to it once the skip track has executed.

  3. gossnj,

    Er, whoops. Here is the code.

    tell application “System Events” to set appList to name of application processes whose frontmost is true set frontApp to item 1 of appList tell application “Last.fm” to activate tell application “System Events” tell process “Last.fm” click menu item “Skip” of menu “Controls” of menu bar 1 end tell end tell tell application frontApp to activate

Post a comment





Submit your comment

WordPressRSSXHTMLCSS