Here is an applescript that will look up the lyrics of the current song you are listening to in iTunes. Simply cut and paste this code into Script Editor, and save it under ~/Library/Scripts . Call it whatever you want, and it will show up in the scripts menu of iTunes.
The script requires a correct album, artist, and song name. Also, if the repository doesn't have the song, you're out of luck. Still, it's pretty useful to be able to look up lyrics!
[robg adds: To get the script in my iTunes script menu, I had to put it in ~/Library/iTunes/Scripts. Once there, though, it worked as described.]
I apologize the code is a little long...one day I hope to have a site hosting this and others! Comments, criticisms, ideas for anything are always welcome - I'd like to make OS X a better place :)
property nameOfTrack : ""
property nameOfAlbum : ""
property nameOfArtist : ""
tell application "iTunes"
copy name of current track to nameOfTrack
copy album of current track to nameOfAlbum
copy artist of current track to nameOfArtist
set nameOfTrack to my parseWord(nameOfTrack)
set nameOfAlbum to my parseWord(nameOfAlbum)
set nameOfArtist to my parseWord(nameOfArtist)
my openBrowser(nameOfArtist, nameOfAlbum, nameOfTrack)
end tell
on parseWord(myWord)
set myDelims to {"(", ")", "!", "'", "-", "@", "#", "$", "%", ¬
"^", "&", "*", "-", "+", "=", ":", ";", ",", ".", "/", "<", ¬
">", "?", "{", "}", "[", "]"}
repeat with currentDelim in myDelims
set AppleScript's text item delimiters to currentDelim
set myWords to every text item of myWord
set AppleScript's text item delimiters to {""}
set myWord to myWords as string
end repeat
-- convert double spaces to single
set AppleScript's text item delimiters to " "
set myWords to every text item of myWord
set AppleScript's text item delimiters to {" "}
set myWord to myWords as string
-- get rid of spaces
set AppleScript's text item delimiters to {" "}
set myWords to every text item of myWord
set AppleScript's text item delimiters to {"_"}
set myWord to myWords as string
return myWord
end parseWord
on openBrowser(nameOfArtist, nameOfAlbum, nameOfTrack)
tell application "Safari"
activate
make new document at end of documents
--set URL of document 1 to "http://www.getlyrics.com/lyrics.php?Artist=" & ¬
nameOfArtist & "&Album=" & nameOfAlbum & "&Song=" & nameOfTrack
set URL of document 1 to ¬
"http://display.lyrics.astraweb.com:2000/display.cgi?" & ¬
nameOfArtist & ".." & nameOfAlbum & ".." & nameOfTrack
end tell
end openBrowser
Mac OS X Hints
http://hints.macworld.com/article.php?story=20030705225712676