Get link to currently playing Spotify track via AppleScript

I was looking around for a means to grab the URL of the currently playing track in Spotify earlier, but couldn't find anything.

I rattled together an AppleScript to do just that and copy the result, including the track and artist name, to your clipboard.

tell application 'Spotify'
	set theTrack to name of the current track
	set theArtist to artist of the current track
	set theAlbum to album of the current track
	set track_id to id of current track
end tell

set AppleScript's text item delimiters to ':'
set track_id to third text item of track_id
set AppleScript's text item delimiters to {''}
set realurl to ('http://open.spotify.com/track/' & track_id)

set theString to theTrack & ' - ' & theArtist & ': ' & realurl
set the clipboard to theString

"Feel Like Makin' Love - Bad Company: http://open.spotify.com/track/3HKthdb7Ejnydb74BvmQW0"

I used a few bits of this Conceited Software forum post for pointers on accessing Spotify details via AppleScript.

Enjoy,
- Chris