View unanswered posts | View active topics It is currently Sun May 19, 2013 12:42 pm



Reply to topic  [ 10 posts ] 
 Fun voice command script 
Author Message

Joined: Dec 08, 2005
Posts: 31
Post 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


Mon Dec 19, 2005 12:15 am
Profile

Joined: Jul 10, 2005
Posts: 160
Location: Northville, Michigan
Post 
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. :)

_________________
Share and read automation tips and setups:
http://automation.highearthorbit.com/wiki

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


Mon Dec 19, 2005 7:39 am
Profile WWW

Joined: Dec 08, 2005
Posts: 31
Post 
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.


Thu Dec 22, 2005 10:31 pm
Profile

Joined: Dec 25, 2005
Posts: 16
Location: Roseville, CA
Post 
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


Sun Dec 25, 2005 10:09 pm
Profile WWW

Joined: Dec 25, 2005
Posts: 16
Location: Roseville, CA
Post 
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


Sun Dec 25, 2005 11:44 pm
Profile WWW

Joined: Dec 08, 2005
Posts: 31
Post 
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.


Mon Dec 26, 2005 12:53 am
Profile

Joined: Dec 25, 2005
Posts: 16
Location: Roseville, CA
Post 
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


Mon Dec 26, 2005 3:08 pm
Profile WWW

Joined: Dec 08, 2005
Posts: 31
Post 
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.


Tue Dec 27, 2005 1:20 am
Profile

Joined: Jul 21, 2005
Posts: 26
Location: Fontainebleau (France)
Post 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,


Thu Jan 11, 2007 8:18 pm
Profile

Joined: Jun 15, 2012
Posts: 6
Post 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?


Wed Jun 20, 2012 1:06 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.