Return to Snippet

Revision: 24117
at February 21, 2010 16:50 by adkatrit


Initial Code
tell application "iTunes"
	if player state is playing then
		set artist_name to artist of current track
		set track_name to name of current track
	else
		set artist_name to the artist of selection of browser window 1
		set track_name to the name of selection of browser window 1
	end if
end tell

set the artist_name to replace_chars(artist_name, " ", "+")
set the track_name to replace_chars(track_name, " ", "+")

tell application "Safari"
	activate
	set the URL of the front document to ¬
		"http://search.lyrics.astraweb.com/?word=" & artist_name & "+" & track_name & ""
end tell


on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

Initial URL

                                

Initial Description
uses the currently playing itunes song to query astraweb's lyrics database

Initial Title
Itunes lyrics finder

Initial Tags

                                

Initial Language
AppleScript