I need some help with this script. It works fine if you don’t misspell the song name (which was kind of the point of the IF statement)
can someone help me with my script, i’m so close to finishing it.
global blah
global fin
global dif
using terms from application "AOL Instant Messenger (SM)"
on handle event with screen name inScreenName with message inMsg
set person to inScreenName
set request_string to (trim html inMsg)
if requestatm is 1 then
send "Sorry, Person requesting song at the moment, Please try later."
else if requestatm is 0 then
set requestatm to 1
tell application "iTunes"
set fin to (get finish of current track) as real
tell source "Library"
tell playlist "Request List"
if track request_string exists then
set request_track to track request_string
else
tell application "AOL Instant Messenger (SM)"
send "Sorry, Song not found!" to person
end tell
end if
end tell
end tell
set dif to (fin - player position) as real
delay (dif)
play request_track
set fin to (get finish of current track) as real
set dif to (fin - player position) as real
delay (dif)
tell playlist "Party Shuffle"
play
end tell
set requestatm to 0
end tell
end if
end handle event
end using terms from
oops, I was reorgainizing it and I guess I forgot to switch it back
heres the new script (I kinda stripped it down)
It will work if you type in a real track name, but it will error if you mistype it. So I’m back to square one.
global blah
global fin
global dif
using terms from application "AOL Instant Messenger (SM)"
on handle event with screen name inScreenName with message inMsg
set person to inScreenName
set request_string to (trim html inMsg)
tell application "iTunes"
set fin to (get finish of current track) as real
tell source "Library"
tell playlist "Request List"
set request_track to track request_string
end tell
end tell
if request_track exists then
set dif to (fin - player position) as real
delay (dif)
play request_track
set fin to (get finish of current track) as real
set dif to (fin - player position) as real
delay (dif)
tell playlist "Party Shuffle"
play
end tell
else
tell application "AOL Instant Messenger (SM)"
send "Sorry, Song not found!" to person
end tell
end if
end tell
end handle event
end using terms from
OK I figured out the problem, it was trying to set an undefined variable for the exist statement. I also got it fully working too so now I just have to add features