/ Published in: AppleScript
takes the currently playing song on itunes and queries ultimate-guitar.com for tabs ... works best in cahoots with Quicksilver to set up hotkeys ( i use command+shift+f)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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://www.ultimate-guitar.com/search.php?bn=" & artist_name & "&sn=" & track_name & "&type%5B%5D=1&type%5B%5D=3" 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