Zabaware Support Forums
Zabaware Forums => Ultra Hal 7.0 => Topic started by: knight2000 on February 27, 2019, 10:58:53 am
-
Hi Guys,
Is there a command like <MICON> to have Hal stop listening? When I have speech recognition on and i tell Hal to play a song, i'd like him to stop listening, otherwise he responds to the song lyrics haha. If i turn the mic off then i cant turn it back on unless i type it in. I was hoping for some kind of command (function) to execute when i tell Hal to play a song then when the song is done i can say "start listening". Im pretty sure there is something like this already but i'm not sure what it was :-\
-
((poof!)) Genie: At Your command vocally or in text "Microphone On" OR "Microphone Off" HAL will obey. Let it be done!
-
Thanks for the response! I was hoping there was also a programmatic way of having Hal stop listening but I assume <MICON> and <MICOFF> would work.
-
Thats a good plugin but i need to be able to control Hal's mic externally. Example would be if I tell Hal to play a song i would want Hal to turn off his mic while the song is playing then when the song is over turn his mic back on. I have a python script that will get song's length, i want to be able to use python to execute "Ultrahal.exe <SHOWHAL><MICON>" using the command prompt after the song ends. The problem is if Hal is already open, calling Ultrahal.exe <SHOWHAL><MICON> will only show Hal and not enable his mic :(
Any idea's on how to make something like this work?
-
Im using the vrMP3 plugin but i altered the code to grab the length of the song. See below
If vrToPlay <> "" Then
If HalBrain.CheckTableExistence("vrMp3") = False Then
GetResponse = "I dont have that song on file. "
Else
vrNameToPlay = HalBrain.QABrain(vrToPlay, "vrMp3", 0)
If vrNameToPlay <> "" Then
GetResponse = "Here you go! "
'HalCommands = HalCommands & "<MICOFF>"
Set objWSHShell = CreateObject("WScript.Shell")
objWSHShell.Run(""""& vrNameToPlay &"""")
pos = InStrRev(vrNameToPlay, "\") +1
file = Mid(vrNameToPlay, pos)
Const LENGTH = 27
Dim oShell : Set oShell = CreateObject("Shell.Application")
Dim oFolder : Set oFolder = oShell.Namespace("C:\Users\vyaco\Desktop\Hal\music")
Dim oFile : Set oFile = oFolder.ParseName(file)
Dim strLength : strLength = oFolder.GetDetailsOf(oFile, LENGTH)
param1 = "music"
param2 = strLength
objWSHShell.Run hal_commands & param1 & " " & param2
End If
End If
HalBrain.ReadOnlyMode = True
End If
The last line runs the python script and sends params.
objWSHShell.Run hal_commands & param1 & " " & param2
This is my python snippet for toggling Hal's mic
##PLAY A SONG
if command == "music":
command2 = sys.argv[2]
##Mbox('debug', command + " " + command2, 1)
subprocess.Popen([r'C:\Program Files (x86)\Zabaware\Ultra Hal 7\UltraHal7.exe', '<SHOWHAL><MICOFF>'])
t = command2
h,m,s = re.split(':',t)
print int(datetime.timedelta(hours=int(h),minutes=int(m),seconds=int(s)).total_seconds())
duration = int(datetime.timedelta(hours=int(h),minutes=int(m),seconds=int(s)).total_seconds())
##print command2
voice = open(voice_modulator,"w")
voice.writelines("turnoff")
voice.close()
##Mbox('duration', str(duration), 0)
time.sleep(duration)
voice = open(voice_modulator,"w")
voice.writelines("turnon")
voice.close()
subprocess.Popen([r'C:\Program Files (x86)\Zabaware\Ultra Hal 7\UltraHal7.exe', '<SHOWHAL><MICON>'])
So i need to be able to control Hal's mic via python
-
Thats a cool utility, but my problem is that once Hal is running, the command line args do not work. If i exit hal then run my python program, Hal starts up with the mic enabled. Sorry, i probably should have said that before. So even if i pull up a command prompt and execute C:\Program Files (x86)\Zabaware\Ultra Hal 7\UltraHal7.exe <SHOWHAL><MICON> while Hal is already running, his mic doesn't come on. I have to exit Hal completely in order for that command to work.