Skip to content

Instantly share code, notes, and snippets.

@oderwat
Created March 16, 2013 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oderwat/5176287 to your computer and use it in GitHub Desktop.
Save oderwat/5176287 to your computer and use it in GitHub Desktop.
Quick and Dirty "Fetch current running Title from Spotify to Clipboard" for usage as LaunchBar Action (can easily be modified for other Launchers)
try
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
open location "x-launchbar:large-type?string=" & theTrack & "\n" & theArtist
set the clipboard to theString
on error
open location "x-launchbar:large-type?string=No Track found!"
end try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment