Hi all, trying to set up a speakable items script that allows you to say any song in your library and iTunes plays that song. Example: “Play”, wait for confirmation, “(Song Title)” and the song plays. I used to have a script for this which worked perfectly, attached below. After I upgraded from Leopard to Snow Leopard, this script recognized “play” but won’t recognize the song/artist name after that. Is this because it’s taking a long time to load all the titles in my library, or is it getting an timeout error?
My old script was
tell application "iTunes"
set myList to (get name of every track of playlist 1) as list
set myFinishedList to myList & "Cancel"
end tell
tell application "SpeechRecognitionServer"
set myTrack to (listen for myFinishedList with prompt myFinishedList)
end tell
if myTrack is not "Cancel" then
tell application "iTunes"
set myTrackList to (get every track of playlist 1 where name is myTrack)
if number of items of myTrackList is 1 then
play (get first item of myTrackList)
else
set myArtistNames to {"Cancel"} & (get artist of every track of playlist 1 where name is myTrack)
tell application "SpeechRecognitionServer"
set myArtist to (listen for myArtistNames with prompt myArtistNames)
end tell
if myArtist is not "Cancel" then
set myFocusedTrackList to (get every track of playlist 1 where name is myTrack and artist is myArtist)
set randnum to (random number ((number of items of myFocusedTrackList) - 1)) + 1
play (get item randnum of myTrackList)
end if
set randnum to ((random number (numitems - 1)) + 1)
play (get item randnum of myTrackList)
end if
end tell
end if
(I did not make the above script, I got it from macscripter, but it no longer seems to work after upgrading to snow leopard)
Model: MacBook 2.1 GHz
AppleScript: Applescript Utility 1.1, Script Editor 2.2
Browser: Safari 525.20.1
Operating System: Mac OS X (10.6)