Posted By

adkatrit on 02/21/10


Tagged

itunes tabs guitar


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adkatrit


Itunes guitar tab finder


 / 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)

  1. tell application "iTunes"
  2. if player state is playing then
  3. set artist_name to artist of current track
  4. set track_name to name of current track
  5. else
  6. set artist_name to the artist of selection of browser window 1
  7. set track_name to the name of selection of browser window 1
  8. end if
  9. end tell
  10.  
  11. set the artist_name to replace_chars(artist_name, " ", "+")
  12. set the track_name to replace_chars(track_name, " ", "+")
  13.  
  14. tell application "Safari"
  15. activate
  16. set the URL of the front document to ¬
  17. "http://www.ultimate-guitar.com/search.php?bn=" & artist_name & "&sn=" & track_name & "&type%5B%5D=1&type%5B%5D=3"
  18. end tell
  19.  
  20.  
  21. on replace_chars(this_text, search_string, replacement_string)
  22. set AppleScript's text item delimiters to the search_string
  23. set the item_list to every text item of this_text
  24. set AppleScript's text item delimiters to the replacement_string
  25. set this_text to the item_list as string
  26. set AppleScript's text item delimiters to ""
  27. return this_text
  28. end replace_chars

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: god_of_nothing on March 9, 2011

hi , i would be glad if you suggest on my codes

You need to login to post a comment.