KeshHERE Posted May 11, 2016 Posted May 11, 2016 expandcollapse popup#Include <ButtonConstants.au3> #include <EditConstants.au3> #include <StringConstants.au3> HotKeySet("{ESC}", "MyExit") HotKeySet("{SPACE}", "AtoT") HotKeySet("{F9}", "stop") Global $voice = ObjCreate("SAPI.SpVoice") Global $Paused AtoT() Do until @HotKeyPressed="{SPACE}" Func reply() Select Case StringInStr($spoken,"google");;;;;;;;;OPENS GOOGLE IN DEFAULT BROWSER ShellExecute("https://www.google.com") Case StringInStr($spoken,"youtube");;;;;;;;;OPENS YOUTUBE IN DEFAULT BROWSER ShellExecute("https://www.youtube.com") Case StringInStr($spoken,"mail");;;;;;;;;;;;OPENS GMAIL IN DEFAULT BROWSER ShellExecute("https://www.gmail.com") Case StringInStr($spoken,"notepad");;;;;;;;;;OPENS NOTEPAD Run("notepad.exe") Case StringInStr($spoken,'computer');;;;;;;;;OPENS MY COMPUTER FOLDER Send("{LWINDOWN}e{LWINUP}") Case StringInStr($spoken,'bye');;;;;;;;;;;;;;CLOSES THE PROGRAM speak('Goodbye sir!') Sleep(2000) Exit case StringInStr($spoken,'Sleep');;;;;;;;;;;;;PROGRAM SLEEPS UNTILL YOU PRESS SPACE Send("{F9}") Send("{F9}") Send("{F9}") case StringInStr($spoken,'close');;;;;;;;;;;;;CLOSES THE ACTIVE WINDOWS Send("!{F4}") Case StringInStr($spoken,'time') speak('time') Case StringInStr($spoken,'date') speak('date') EndSelect EndFunc Func stop() EndFunc Func AtoT() speak('How may i help you sir?') Do $h_Context = ObjCreate("SAPI.SpInProcRecoContext") $h_Recognizer = $h_Context.Recognizer $h_Grammar = $h_Context.CreateGrammar(1) $h_Grammar.Dictationload $h_Grammar.DictationSetState(1) $h_Category = ObjCreate("SAPI.SpObjectTokenCategory") $h_Category.SetId("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn\") $h_Token = ObjCreate("SAPI.SpObjectToken") $h_Token.SetId("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn\") $h_Recognizer.AudioInput = $h_Token $h_ObjectEvents = ObjEvent($h_Context, "SpRecEvent_") Until @HotKeyPressed= "{F9}" speak('press button space if you want me back any time.') ToolTip("I WILL WAIT",0,0) Sleep(2000) $h_ObjectEvents = Null $h_Context= Null $h_Recognizer= Null $h_Grammar= Null $h_Category= Null $h_Token= Null EndFunc Func SpRecEvent_Recognition($StreamNumber, $StreamPosition, $RecognitionType, $Result) Global $spoken=$Result.PhraseInfo.GetText ToolTip($spoken,0,0) reply() Global $spoken="" Sleep(2000) ToolTip("") EndFunc ;==>SpRecEvent_Recognition Func MyExit() sleep(100) ToolTip('Script is "terminated"',0,0) sleep(500) FileDelete("my.vbs") Exit ToolTip("") EndFunc Func speak($speak) If $speak='time' Then $t='speaks=hour(time) & "hour" & minute(time) & "minutes" & second(time) & "seconds"'&@CRLF&'set speech= CreateObject("sapi.spvoice")'&@CRLF&'speech.Rate = -3'&@CRLF&'speech.Speak speaks' FileWrite("t.vbs",$t) RunWait('cscript.exe "t.vbs"',"",@SW_MINIMIZE) FileDelete('t.vbs') ElseIf $speak='date' Then $d='speaks=date'&@CRLF&'set speech= CreateObject("sapi.spvoice")'&@CRLF&'speech.Rate = -3'&@CRLF&'speech.Speak speaks' FileWrite("d.vbs",$d) RunWait('cscript.exe "d.vbs"',"",@SW_MINIMIZE) FileDelete('d.vbs') Else $Voice.Speak($speak,11) Sleep(500) EndIf EndFunc well obviously, if you are making AI like JARVIS you need speech reco., but my last JARVIS was typing input based, because computer doesn't get my voice clearly due to my accent. But if you think your speech recognition(comes inbuilt) works great with you voice then this might be it. You can add as many commands and its function as you want under separate new case of "FUNC reply()" like this Quote case stringinstr($spoken,'command by which you want JARVIS to recognize') all you want to make your computer do when it hears that command goes here pretty basic commands like for -opening my computer -opening notepad -opening google/youtube/gmail in default browser -sleep(to make JARVIS sleep, not computer) -bye(to close JARVIS) -time/date -close(to close active windows) are already inside. try not to change "FUNC AtoT()" and "Func SpRecEvent_Recognition()" unless you know what you are doing. to make program sleep (if it doesnt recognize "sleep" when you say it) press F9. to close the whole program press ESC. If you want to know what is being recognized from my speech by your computer, look at left upper corner after you speak. PLEASE LET ME KNOW IF YOU HAVE ANY SUGGESTIONS OR REVIEWS. JARVIS with SPEECH reco.au3
spudw2k Posted May 13, 2016 Posted May 13, 2016 Looks fun, I haven't tested. I'm curious though... In your speak function, for time and date values you write, execute and delete a vbasic script. Why don't you just use native AutoIt functions? You are already create a SAPI Voice object and use it elsewhere. The vbscript is erroneous and unnecessary. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
KeshHERE Posted May 15, 2016 Author Posted May 15, 2016 On 5/13/2016 at 7:37 PM, spudw2k said: Looks fun, I haven't tested. I'm curious though... In your speak function, for time and date values you write, execute and delete a vbasic script. Why don't you just use native AutoIt functions? You are already create a SAPI Voice object and use it elsewhere. The vbscript is erroneous and unnecessary. Thnks for replying. I made vbs script for time and date because i didn't know how to do it with autoit. And i still dont. Let me know if you know it. Thank you.
spudw2k Posted May 17, 2016 Posted May 17, 2016 https://www.autoitscript.com/autoit3/docs/macros/TimeAndDate.htm Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now