Fun voice command script

Posted on
Mon Dec 19, 2005 12:15 am
doctorlambo offline
Posts: 31
Joined: Dec 08, 2005

Fun voice command script

Here is a script I made today. If you use it, make sure you isight and voice recog are both on. This will control itunes. If you create a group action in indigo called "all on" and "all off", you can control events in your house. Here are the commands it does so far"

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

Posted on
Mon Dec 19, 2005 7:39 am
ajturner offline
Posts: 160
Joined: Jul 10, 2005
Location: Washington, DC

(No subject)

Looks cool! I haven't tried it yet, but I noticed that your timeout is: 2 * days. Seems kind of long?

Also, your "code" tags are switched. :)

Control Indigo from anywhere in the world:
http://highearthorbit.com/software/indigowidget

Posted on
Thu Dec 22, 2005 10:31 pm
doctorlambo offline
Posts: 31
Joined: Dec 08, 2005

(No subject)

yeah, you can change the time. I debated on what to do there. The Speech stuff is neat, but it can be inaccurate. You may want to change the keyword in the code to match your voice type better. It is fun to use. It is easy and accurate with indigo. It is a little more tricky with ichat names.

Posted on
Sun Dec 25, 2005 10:09 pm
JamesDW offline
Posts: 16
Joined: Dec 25, 2005
Location: Roseville, CA

(No subject)

Okay. So I am new to Indigo and Applescript. I currently have 4 dimmers, 1 RF Remote, 1 RF Receiver and the controller.

Where in Indigo do I place this applescript?

James

Posted on
Sun Dec 25, 2005 11:44 pm
JamesDW offline
Posts: 16
Joined: Dec 25, 2005
Location: Roseville, CA

(No subject)

I actually read the manual and found where I place the script! :lol:
Now I am having a problem. I see that when I open Indigo, the script is loading but nothing is happening when I say the commands. However, when I manually run the script through script editor with Indigo open, everything works great.

How do I get the script to RUN when it is loaded by Indigo?

James

Posted on
Mon Dec 26, 2005 12:53 am
doctorlambo offline
Posts: 31
Joined: Dec 08, 2005

(No subject)

Ok, so this is a little different with this script. Dont put this script in Indigo. Make an action group in indigo called "all on" and do another one called "all off". You can make this any situation you wish. Now, copy this applescript and put it into your application called Script Editor. Push Play when you get it into the script editor. It will now be listening for the commands listed. If you say "lights on" it will tell the Indigo program to execute the group you named "all on". If you told it to "play music", it will play your top 25 playlist in itunes. So, this is a script that will control itunes if you wish, along with other programs. It is not a script to be put into Indigo itself. The script is a continuous loop. So, it just goes over and over until you stop it. If you like it, save the script as an application that way you can run it by clicking on thre icon, rather than opening it in the script editor. The Voice Server is a little "rough" or tough to properly script, so it is more fun than practical at this point. Oh yeah, make sure your voice recog is on in your sys pref.

Posted on
Mon Dec 26, 2005 3:08 pm
JamesDW offline
Posts: 16
Joined: Dec 25, 2005
Location: Roseville, CA

(No subject)

Thanks! Actually it has been operating great. I removed the other items not related to Indigo and added more group actions. I even impressed my wife when I said "Romantic Dinner" and the dining room lights came on and dimmed!

However, it seems that the script is timing out after a few minutes of non-use. Any idea why?

James

Posted on
Tue Dec 27, 2005 1:20 am
doctorlambo offline
Posts: 31
Joined: Dec 08, 2005

(No subject)

I dont really know why it would time out. I have it set to time out after 2 days. I am not too familiar with the voice server, and there arent alot of people out there that seem like they do. I will look around.

Posted on
Thu Jan 11, 2007 8:18 pm
Paco offline
Posts: 26
Joined: Jul 21, 2005
Location: Fontainebleau (France)

French voice in European voice packs

Hello,

Just a word to tell Indigo European users about very high quality voice collection packs, include french, from AssistiveWare Infovox iVox

http://www.assistiveware.com/infovox_ivox.php

It works very fine with Indigo + Phlink and it's a great pleasure being called by a french woman voice to say : "Bonjour, un cambrioleur est entré dans votre maison." (Hi, a burglar is forcing your house).

Unfortunately, at my knowledge, the voice recognition still works only in english.

Regards,

Posted on
Wed Jun 20, 2012 1:06 am
LCARS6049 offline
Posts: 6
Joined: Jun 15, 2012

Re: Fun voice command script

Is there a way to make the script play a tactile feedback sound of the user's choice when the system recognizes a command before it executes the programmed instructions?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 28 guests