' ' check_vcmd for muliple users and toggled attention. 11/6/99 Rick LaBanca, http://members.home.com/rickla1/ha ' ' ** RENAME TO check_vcmd.txt OR IT WON'T WORK! ** ' ' I wanted to switch to another speech training user for better accuracy, and ' didn't want to say the attention phrase before every single command. This only ' works with homeseer 1.3.5 and above, where it looks for check_vcmd after ' any speech input. ' ' To add another user for training is not possible with just agent installed. I ' installed the microsoft SAPI sdk for developers and the sample dictionation ' app's config options let you add users. ' But when you call hs.setSpeaker it seems to add the user specified if they don't ' exist so that's a hacky work around. ' ' It's a bit manual to set it up because you have to make some dummy events ' and edit this a bit. ' ' - Turn off "use attention phrase" in the options screen, voice settings ' - Add in two dummy events that don't do anything but set up a voice trigger: ' - One for an attention phrase, in this case it's "this is [0+] rick [0+] leanne" ' - One for sleep, in this case it's "Goodbye". ' Those are needed to recognize the words, they don't do anything else. ' - Edit the init part of this script for your attention phrase and "sleep" phrase ' - Edit the script to recognize the variations as in my sample, and optionally ' switch voice recog training users. ' - If you want to switch users make sure they are already set up in sapi! ' - To wake up the computer, use your attention phrase. ' - Keep doing commands ' - Say the sleep phrase to put it back in wait for waiting for attention mode. Const STATE_VARIABLE_NAME = "AttentionState" sub main() dim state hs.CreateVar STATE_VARIABLE_NAME state = hs.GetVar(STATE_VARIABLE_NAME) if state = "" then hs.SaveVar STATE_VARIABLE_NAME, "attention" state = "attention" end if dim s s = hs.LastVoiceCommand if state = "attention" then if s="this is rick" then hs.setSpeaker "Rick LaBanca" hs.speak "Hi rick" hs.SaveVar STATE_VARIABLE_NAME, "command" hs.LastVoiceCommand = "*" elseif s="this is leanne" then hs.setSpeaker "Leanne LaBanca" hs.speak "Hi leanne" hs.SaveVar STATE_VARIABLE_NAME, "command" hs.LastVoiceCommand = "*" else hs.LastVoiceCommand = "*" end if else if s="goodbye" then hs.SaveVar STATE_VARIABLE_NAME, "attention" end if end if end sub