Hi guys,
I'm a new QS user but loving it.

I just discovered a new script called "Lyrics via LyricWiki" for
ITunes, and I want to make it a triggerable hot key in QS. But there's
a problem: The actual script is a "script bundle" with the file
extension ".scptd." I seem to be unable to get QS to "run" this script
bundle, as QS only opens it with Script Editor or just...does
nothing!:)

I'm pasting the script below. Any one with ideas on how to make this a
trigger-able hot key?

Thanks in advance for your time and help!

(*
"Lyrics via LyricWiki" for iTunes
written by Doug Adams
[email protected]
Thanks to the many Correspondents who emailed me info on the SOAP
command.
<http://lyricwiki.org/LyricWiki_talk:SOAP>

v1.0 February 28 2009
-- initial release

Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes
http://dougscripts.com/itunes/

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

Get a copy of the GNU General Public License by writing to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA  02110-1301, USA.

or visit http://www.gnu.org/copyleft/gpl.html

*)

property my_title : "Lyrics via LyricWiki"
property nom : ""
property art : ""
global sel
tell application "iTunes"
        if player state is playing then
                set sel to current track
                tell sel to set {nom, art} to {get name, get artist}
        else if selection is not {} and (count items of selection) is 1 then
                set sel to item 1 of selection
                tell sel to set {nom, art} to {get name, get artist}
        else
                return
        end if
end tell
log {nom, art}
if nom is "" or art is "" then
        display dialog "The track does not have enough information to search
LyricWiki." buttons {"OK"} with icon stop with title my_title
        return
end if
try
        tell application "http://lyricwiki.org/server.php"; to set rez to
(call soap {method name:"getSong", method namespace
uri:"urn:LyricWiki", SOAPAction:"urn:LyricWiki#getSong", parameters:
{artist:art as text, song:nom as text}})
on error m
        tell application "iTunes"
                display dialog "Error from LyricWiki:" & return & return & tab 
& m
with title my_title
        end tell
end try
-- log rez
set theLyrics to (lyrics of rez) as text
set lyricWikiPageURL to |url| of rez

log theLyrics

-- copy to lyrics or display LyricsWiki page?
if theLyrics does not contain "Not found" then
        set displayLyrics to my text_to_list(theLyrics, (ASCII character 10))

        set opt to (choose from list displayLyrics with prompt (art & return
& "\"" & nom & "\"") as text OK button name "Use Lyrics for Track"
with empty selection allowed)
        if opt is false then return
        (*
        tell application "Finder"
                open location lyricWikiPageURL
        end tell
        *)
        tell application "iTunes"
                try
                        set sel's lyrics to theLyrics
                end try
        end tell
else
        display dialog "Lyrics for \"" & art & "\" - \"" & nom & "\" not
found at LyricWiki." buttons "OK" with icon stop with title my_title
end if


on text_to_list(txt, delim)
        set saveD to AppleScript's text item delimiters
        try
                set AppleScript's text item delimiters to {delim}
                set theList to every text item of txt
        on error errStr number errNum
                set AppleScript's text item delimiters to saveD
                error errStr number errNum
        end try
        set AppleScript's text item delimiters to saveD
        return (theList)
end text_to_list

Reply via email to