Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!


Click here to return to the 'Easily add lyrics to iTunes songs via AppleScript' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Easily add lyrics to iTunes songs via AppleScript
Authored by: musselrock on Sat, Jul 19 2008 at 11:26AM PDT
I like the concept very much. It is a good idea. To make this hint work better for me, I created two scripts - one to search for lyrics and one to add lyrics from a web page.

Search script (run from within iTunes):

tell application "iTunes"
set theName to name of current track
set arts to artist of current track
set searchTerm to arts & " " & theName & " lyrics"
end tell
set thewords to words of searchTerm
set oldtids to AppleScript's text item delimiters
set AppleScript's text item delimiters to "+"
set googstring to thewords as text
set AppleScript's text item delimiters to oldtids
set serURL to "http://www.google.com/search?client=safari&rls=en-us&q="; & googstring & "&ie=UTF-8&oe=UTF-8"
tell application "Safari"
open location serURL
activate
end tell

Get lyrics into iTunes (run from within Safari):

tell application "Safari"
set selecTxt to (do JavaScript "(getSelection())" in document 1)
end tell

tell application "iTunes"
set lyrics of current track to selecTxt
end tell


[ Reply to This | # ]