lights on
make it dark
play music
turn music off
call friend
quit ichat
- Code: Select all
repeat
tell application "SpeechRecognitionServer"
activate
try
set heardPhrase to listen for {"lights on", "make it dark", "call friend", "quit ichat", "play music", "turn music off"} giving up after 2 * days
on error -- time out
return
end try
end tell
if heardPhrase is "lights on" then
tell application "IndigoServer"
activate
delay 5
execute group ("all on")
end tell
else if heardPhrase is "make it dark" then
tell application "IndigoServer"
activate
delay 5
execute group ("all off")
end tell
else if heardPhrase is "call friend" then
delay 1
say "which friend do you want to call" using "Victoria"
tell application "SpeechRecognitionServer"
activate
tell application "iChat"
get name of accounts
set nameAccounts to name of accounts
end tell
try
set heardFriend to listen for nameAccounts giving up after 2 * days
on error -- timed out
return
end try
end tell
tell application "iChat"
activate
set theStatus to get capabilities of account heardFriend
if theStatus contains video chat then
send video invitation to account heardFriend
else
quit "ichat"
end if
end tell
else if heardPhrase is "quit ichat" then
tell application "iChat"
repeat until number of windows is 3
tell window 1 to close
end repeat
quit "ichat"
end tell
else if heardPhrase is "play music" then
tell application "iTunes"
activate
delay 5
play playlist "top 25 most played"
end tell
else if heardPhrase is "turn music off" then
tell application "iTunes"
quit
end tell
end if
end repeat