Q:

If yes_list then... applescript

Hi I am new to apple script but I am trying to make a stand alone application that upon request will open Apple Mail using yes and no lists. I am a newbie so any help would be appreciated. I have attached my code below.    
set Unread_Count to unread count of inbox
if Unread_Count is 0 then
    say "Sir, it appears you have no new email's"
else if Unread_Count is 1 then
    say "You have 1 new email"
else
    say "You have " & (get Unread_Count) & " unread emails"
end if
end tell
tell application "SpeechRecognitionServer"
set yes_list to {"yes", "yes open mail", "yes open mail server", "yes please"}
set no_list to {"That's all", "no"}

set answer to listen for yes_list & no_list with prompt "Would you like me to open your mail server? Or will that be all."
-- you have to hold the Listening key (by default ⎋) to record a reply
if answer is no_list then
    delay 0.2
    say "Very well sir."
end if

if answer is yes_list then
    tell application "Mail"
        reopen
        activate
end tell
end if
end tell 

Unfortunately my actions are not working even though my commands are being recognized. Any help would be greatly appreciated! Thanks!

A:

Use the contains keyword:
tell application "SpeechRecognitionServer"
    set l1 to {"yes", "maybe"}
    set l2 to {"no"}
    set answer to listen for l1 & l2 with prompt "prompt"
    l1 contains answer
end tell

If others test this, you have to enable speakable items from System Preferences first, and hold the listening key (by default escape) to record the answer.

