ConsultingJoe Posted March 14, 2006 Share Posted March 14, 2006 Hey first I'd like to say This script isn't completed. It may only be missing ini R/W and form setting functions btu I got to tired or messing with it. There are 2 uncompleted scripts, same thing just one is redone. Play with it or finish it or mess with it. It would be cool to have it done. It is the same as http://www.voiceflux.net only not even close to being as niceYou must have write.exe in the same directory, that code is:CODE#NoTrayIcon$RecoContext=ObjCreate("SAPI.SpSharedRecoContext")$SinkObject=ObjEvent($RecoContext,"MYEvent_") $Grammar = $RecoContext.CreateGrammar(1) $Grammar.Dictationload $Grammar.DictationSetState(1) sleep(5000) $Grammar.DictationSetState(0)Func MYEvent_Recognition($StreamNumber,$StreamPosition,$RecognitionType,$Result) $file = FileOpen ( "heard.txt", 2) FileWrite ( $file, $Result.PhraseInfo.GetText ) FileClose ( $file ) exitEndFuncHere is the two voice commander programsfirst is called new_VC.au3CODE#include <GUIConstants.au3>#Include <Constants.au3>#NoTrayIconGlobal $command = "", $ini_file = "default.ini", $from_file = "1", $runbrowse = "1", $voicenumber = 0, $ttspitch = 0, $ttsspeed = 0, $recogGlobal $Group3, $Radio1, $Radio2, $Radio3, $Input3, $Input4, $Input5, $editbox, $runbrowse, $runpath, $RunCommand, $OnlineHelp, $sendspeed, $sendfilepath, $sendspeedtext = 5Global $Window, $quotelabel,$ttsvoicecombo, $ttsspeedlabel, $ttsspeakcombo, $ttsspeedtext, $ttspitchlabel, $ttspitchtext, $ttsspeakcombo, $ttsedit,$sendtext, $sendpathGlobal $command, $tts_text, $listen = "Begin Listening", $sr = "off", $RunCommanddata = "MsgBox(0,'Hello','Hello')", $ttseditdata = "", $commandlistitems, $commandlistitemnameFileInstall("C:\write.exe", @ScriptDir & "\write.exe", 1)FileInstall("C:\icon.ico", @ScriptDir & "\icon.ico", 1)$intro = GUICreate("Voice Commander", 497, 299, @DesktopWidth/4.5, @DesktopHeight/4.5, -1, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUISetBkColor(0x0000FF)GUICtrlCreateLabel("Voice Commander", 64, 56, 367, 68)GUICtrlSetFont(-1, 36, 800, 0, "Scruff LET")GUICtrlSetBkColor(-1, 0x0000FF)GUICtrlCreateLabel("By: zerocool60544", 240, 176, 203, 37)GUICtrlSetFont(-1, 22, 400, 2, "One Stroke Script LET")GUICtrlSetBkColor(-1, 0x0000FF)GUICtrlCreateLabel("jsammarco@gmail.com", 248, 216, 198, 32)GUICtrlSetFont(-1, 16, 400, 2, "Palatino Linotype")GUICtrlSetBkColor(-1, 0x0000FF)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 1000, "long", 0x00080000);fade-inHotKeySet( "{F9}", "listentoggle" )$hwnd = GUICreate("Voice Commander", 497, 299, @DesktopWidth/4.5, @DesktopHeight/4.5, -1, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUISetBkColor(0xA6CAF0)$Group1 = GUICtrlCreateGroup("Voice Commander-------------------------------By: zerocoool60544", 200, 24, 289, 265, $BS_FLAT)GUICtrlSetBkColor(-1, 0xA6CAF0)GUICtrlCreateLabel("Command Name", 232, 56, 82, 17)GUICtrlSetBkColor(-1, 0xA6CAF0)$commandname = GUICtrlCreateInput("", 208, 72, 129, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUICtrlSetTip(-1, "This is the name of the command for reference")GUICtrlCreateLabel("Command Word", 232, 104, 80, 17)GUICtrlSetBkColor(-1, 0xA6CAF0)$commandword = GUICtrlCreateInput("", 208, 120, 129, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUICtrlSetTip(-1, "This is the word the computer waits to hear")$commandcombo = GUICtrlCreateCombo("TEXT TO SPEECH", 208, 160, 129, 21, BitOR($CBS_DROPDOWNLIST,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUICtrlSetData(-1, "MISCELLANEOUS|RUN PROGRAM|SEND KEYS")GUICtrlSetTip(-1, "These are the commands to execute")$SaveAdd = GUICtrlCreateButton("Save/Add", 368, 120, 105, 41)$DeleteCommand = GUICtrlCreateButton("Delete", 368, 176, 105, 41)$TestCommand = GUICtrlCreateButton("Test Command", 368, 64, 105, 41)$configure = GUICtrlCreateButton("Configure Command", 208, 192, 129, 25)$InitiateCommandtext = GUICtrlCreateInput("Computer", 352, 256, 129, 21, -1, $WS_EX_CLIENTEDGE)GUICtrlSetTip(-1, "Word to listen for")$InitiateCommand = GUICtrlCreateCheckbox("Use Initiate Command", 208, 256, 129, 25)GUICtrlSetBkColor(-1, 0xA6CAF0)GUICtrlSetTip(-1, "Enable/Disable Iniate Command")GUICtrlCreateGroup("", -99, -99, 1, 1)GUICtrlSetTip(-1, "These are the commands to execute")$commandlist = GUICtrlCreateTreeView(8, 24, 184, 238)$commandlistitems = GUICtrlCreateTreeViewItem("My Voice Commands", $commandlist)$import = GUICtrlCreateButton("Import INI", 8, 264, 89, 25)$export = GUICtrlCreateButton("Export INI", 104, 264, 89, 25)TraySetIcon ( @ScriptDir & "\icon.ico" )Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.$start_stopitem = TrayCreateItem("Begin Listen F9")TrayCreateItem("")$exititem = TrayCreateItem("Exit")TraySetState()Sleep(1000)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 500, "long", 0x00050010)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040010)GUISetState()sleep(500)GUIDelete($intro)While 1 $msg = GuiGetMsg() $traymsg = TrayGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $configure configure(GUICtrlRead($commandname),GUICtrlRead($commandword)) case $traymsg = $exititem Exit case $traymsg = $start_stopitem listentoggle() EndSelect WEndExitFunc listentoggle() if $sr = "off" Then TrayItemSetText ( $start_stopitem, "Stop Listen F9") TrayTip ( "Voice Commander", "Listening", 5 ) $sr = "on" else $sr = "off" TrayItemSetText ( $start_stopitem, "Begin Listen F9" ) TrayTip ( "Voice Commander", "Now Listening", 5 ) EndIfEndFuncFunc configure($name, $word) $command = GUICtrlRead( $commandcombo );MISCELLANEOUS|RUN PROGRAM|SEND KEYS|TEXT TO SPEECH Select case $command = "MISCELLANEOUS" $Form1 = GUICreate("Miscellaneous", 151, 184, 192, 125, -1, $WS_EX_TOOLWINDOW) $Combo1 = GUICtrlCreateCombo("Close VC", 36, 24, 85, 21) GUICtrlSetData(-1, "Shutdown") $Button1 = GUICtrlCreateButton("OK", 32, 152, 81, 25) GUISetState(@SW_SHOW) while 1 if GuiGetMsg() = $Button1 Then IniDelete( $ini_file, $name ) Select case GUICtrlRead($Combo1) = "Close VC" IniWrite($ini_file, $name, "word", $word) IniWrite($ini_file, $name, "misc", "close vc") case GUICtrlRead($Combo1) = "Shutdown" IniWrite($ini_file, $name, "word", $word) IniWrite($ini_file, $name, "misc", "shutdown") GUIDelete($Form1) EndSelect GUIDelete($Form1) Return EndIf Sleep(50) WEnd case $command = "RUN PROGRAM" $Form1 = GUICreate("Run Program", 151, 184, 192, 125, -1, $WS_EX_TOOLWINDOW) $Input1 = GUICtrlCreateInput("", 8, 24, 135, 21, -1, $WS_EX_CLIENTEDGE) $Button2 = GUICtrlCreateButton("Browse", 32, 52, 81, 25) $Button1 = GUICtrlCreateButton("OK", 32, 152, 81, 25) GUISetState(@SW_SHOW) while 1 $msg = GuiGetMsg() if $msg = $Button1 Then IniDelete( $ini_file, $name ) IniWrite($ini_file, $name, "word", $word) IniWrite($ini_file, $name, "run", GUICtrlRead($Input1)) GUIDelete($Form1) Return ElseIf $msg = $Button2 Then $run = FileOpenDialog( "Select Program", @ProgramFilesDir, "Programs (*.exe)", 3) if @error then ContinueLoop Else GUICtrlSetData($Input1, $run) EndIf EndIf Sleep(50) WEnd case $command = "SEND KEYS" $Form1 = GUICreate("Send Keys", 151, 184, 192, 125, -1, $WS_EX_TOOLWINDOW) $Edit1 = GUICtrlCreateEdit("", 8, 56, 137, 89, -1, $WS_EX_CLIENTEDGE) $Button1 = GUICtrlCreateButton("OK", 32, 152, 81, 25) GUISetState(@SW_SHOW) while 1 if GuiGetMsg() = $Button1 Then IniWrite($ini_file, $name, "word", $word) IniWrite($ini_file, $name, "send", GUICtrlRead($Edit1)) GUIDelete($Form1) Return EndIf Sleep(50) WEnd case $command = "TEXT TO SPEECH" $Form1 = GUICreate("Text To Speech", 151, 184, 192, 125, -1, $WS_EX_TOOLWINDOW) $Combo1 = GUICtrlCreateCombo("Sam", 8, 24, 65, 21) GUICtrlSetData(-1, "Anna|Mike|Mary|Sam") $Edit1 = GUICtrlCreateEdit("", 8, 56, 137, 89, -1, $WS_EX_CLIENTEDGE) $Input1 = GUICtrlCreateInput("0", 80, 24, 25, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "(-20 to 20)") $Input2 = GUICtrlCreateInput("0", 120, 24, 25, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "(-20 to 20)") GUICtrlCreateLabel("Voice", 16, 8, 59, 17) GUICtrlCreateLabel("Pitch", 80, 8, 28, 17) GUICtrlCreateLabel("Speed", 112, 8, 35, 17) $Button1 = GUICtrlCreateButton("OK", 32, 152, 81, 25) GUISetState(@SW_SHOW) while 1 if GuiGetMsg() = $Button1 Then IniWrite($ini_file, $name, "word", $word) IniWrite($ini_file, $name, "voice", GUICtrlRead($Combo1)) IniWrite($ini_file, $name, "text", GUICtrlRead($Edit1)) IniWrite($ini_file, $name, "pitch", GUICtrlRead($Input1)) IniWrite($ini_file, $name, "speed", GUICtrlRead($Input2)) GUIDelete($Form1) Return EndIf Sleep(50) WEnd EndSelectEndFuncFunc OnAutoItExit ( )$intro = GUICreate("Voice Commander", 497, 299, @DesktopWidth/4.5, @DesktopHeight/4.5, -1, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUISetBkColor(0x0000FF)GUICtrlCreateLabel("Voice Commander", 64, 56, 367, 68)GUICtrlSetFont(-1, 36, 800, 0, "Scruff LET")GUICtrlSetBkColor(-1, 0x0000FF)GUICtrlCreateLabel("By: zerocool60544", 240, 176, 203, 37)GUICtrlSetFont(-1, 22, 400, 2, "One Stroke Script LET")GUICtrlSetBkColor(-1, 0x0000FF)GUICtrlCreateLabel("jsammarco@gmail.com", 248, 216, 198, 32)GUICtrlSetFont(-1, 16, 400, 2, "Palatino Linotype")GUICtrlSetBkColor(-1, 0x0000FF)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 500, "long", 0x00080000);fade-inSleep(1000)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 500, "long", 0x00050010);implodeEndFuncthe second is call Voice Commander.au3CODE#include <GUIConstants.au3>Global $command = "", $ini_file = "default.ini", $from_file = "1", $runbrowse = "1", $voicenumber = 0, $ttspitch = 0, $ttsspeed = 0, $recogGlobal $Group3, $Radio1, $Radio2, $Radio3, $Input3, $Input4, $Input5, $editbox, $runbrowse, $runpath, $RunCommand, $OnlineHelp, $sendspeed, $sendfilepath, $sendspeedtext = 5Global $Window, $quotelabel,$ttsvoicecombo, $ttsspeedlabel, $ttsspeakcombo, $ttsspeedtext, $ttspitchlabel, $ttspitchtext, $ttsspeakcombo, $ttsedit,$sendtext, $sendpathGlobal $command, $tts_text, $listen = "Begin Listening", $sr = "off", $RunCommanddata = "MsgBox(0,'Hello','Hello')", $ttseditdata = "", $commandlistitems, $commandlistitemnameFileInstall(@ScriptDir & "\write.exe", @ScriptDir & "\write", 1)$intro = GUICreate("", 495, 297, @DesktopWidth/4.5, @DesktopHeight/4.5, -1, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUISetBkColor(0x0000FF)GUICtrlCreateLabel("Voice Commander", 64, 56, 367, 68)GUICtrlSetFont(-1, 36, 800, 0, "Scruff LET")GUICtrlSetBkColor(-1, 0x0000FF)GUICtrlCreateLabel("By: zerocool60544", 240, 176, 203, 37)GUICtrlSetFont(-1, 22, 400, 2, "One Stroke Script LET")GUICtrlSetBkColor(-1, 0x0000FF)GUICtrlCreateLabel("jsammarco@gmail.com", 248, 216, 198, 32)GUICtrlSetFont(-1, 16, 400, 2, "Palatino Linotype")GUICtrlSetBkColor(-1, 0x0000FF)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 1000, "long", 0x00080000);fade-in$hwnd = GUICreate("Voice Commander", 497, 299, @DesktopWidth/4.5, @DesktopHeight/4.5, -1, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUISetBkColor(0xA6CAF0)$Group1 = GUICtrlCreateGroup("Voice Commander--------------------------------By: zerocoool60544", 200, 24, 289, 265, $BS_FLAT)GUICtrlSetBkColor(-1, 0xA6CAF0)GUICtrlCreateLabel("Command Name", 232, 56, 82, 17)GUICtrlSetBkColor(-1, 0xA6CAF0)$commandname = GUICtrlCreateInput("", 208, 72, 129, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUICtrlSetTip(-1, "This is the name of the command for reference")GUICtrlCreateLabel("Command Word", 232, 104, 80, 17)GUICtrlSetBkColor(-1, 0xA6CAF0)$word = GUICtrlCreateInput("", 208, 120, 129, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUICtrlSetTip(-1, "This is the word the computer waits to hear")$commandcombo = GUICtrlCreateCombo("", 208, 160, 129, 21, BitOR($CBS_DROPDOWNLIST,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))GUICtrlSetData(-1, "MISCELLANEOUS|RUN PROGRAM|SEND KEYS|TEXT TO SPEECH")GUICtrlSetTip(-1, "These are the commands to execute")$SaveAdd = GUICtrlCreateButton("Save/Add", 368, 120, 105, 41)$DeleteCommand = GUICtrlCreateButton("Delete", 368, 176, 105, 41)$TestCommand = GUICtrlCreateButton("Test Command", 368, 64, 105, 41)$configure = GUICtrlCreateButton("Configure Command", 208, 192, 129, 25)$InitiateCommandtext = GUICtrlCreateInput("Computer", 352, 256, 129, 21, -1, $WS_EX_CLIENTEDGE)GUICtrlSetTip(-1, "Word to listen for")$InitiateCommand = GUICtrlCreateCheckbox("Use Initiate Command", 208, 256, 129, 25)GUICtrlSetBkColor(-1, 0xA6CAF0)GUICtrlSetTip(-1, "Enable/Disable Iniate Command")GUICtrlCreateGroup("", -99, -99, 1, 1)GUICtrlSetTip(-1, "These are the commands to execute")$commandlist = GUICtrlCreateTreeView(8, 24, 184, 238)$commandlistitems = GUICtrlCreateTreeViewItem("My Voice Commands", $commandlist)$import = GUICtrlCreateButton("Import INI", 8, 264, 89, 25)$export = GUICtrlCreateButton("Export INI", 104, 264, 89, 25)Sleep(1000)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 500, "long", 0x00050010)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040010)GUISetState()if FileExists($ini_file) then $ini_sections = IniReadSectionNames ( $ini_file ) For $i = 1 To $ini_sections[0] $commandlistitems = $ini_sections[$i] & "|" & $commandlistitems Next GUICtrlSetData( $commandlist, "") GUICtrlSetData( $commandlist, $commandlistitems) $commandlistitems = ""Else IniWrite ( $ini_file, "Exit", "special", "exit") IniWrite ( $ini_file, "Stop Listening", "special", "stop") IniWrite ( $ini_file, "Close Media Player", "word", "Close Player" ) IniWrite ( $ini_file, "Close Media Player", "type", "Close Window" ) IniWrite ( $ini_file, "Close Media Player", "window", "Windows Media Player" ) $ini_sections = IniReadSectionNames ( $ini_file ) For $i = 1 To $ini_sections[0] $commandlistitems = $ini_sections[$i] & "|" & $commandlistitems Next GUICtrlSetData( $commandlist, "") GUICtrlSetData( $commandlist, $commandlistitems) $commandlistitems = ""EndIfWhile 1 $msg = GuiGetMsg() if $msg <> "" Then Select sleep(25) Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $listenbutton if GUICtrlRead($listenbutton) = "Begin Listening" Then GUICtrlSetData($listenbutton, "End Listening") start() else GUICtrlSetData($listenbutton, "Begin Listening") stop() EndIf Case $msg = $from_file or $msg = $runbrowse if $command = "Run Program" Then GUICtrlSetData ( $runpath, selectfile()) ElseIf $command = "Send Keys" Then $selected = selectfile() GUICtrlSetData ( $sendfilepath, $selected ) GUICtrlSetData ( $editbox, FileRead($selected) ) else ContinueCase EndIf Case $msg = $SaveAdd SaveAdd() Case $msg = $TestCommand TestCommand() Case $msg = $import import() Case $msg = $export export() Case $msg = $DeleteCommand DeleteCommand() Case $msg = $radio1 Opt("WinTitleMatchMode", 1) Case $msg = $radio2 Opt("WinTitleMatchMode", 2) Case $msg = $radio3 Opt("WinTitleMatchMode", 3) Case GUICtrlRead ( $commandcombo ) <> $command $command = GUICtrlRead ( $commandcombo ) changecommand() EndSelectElse if $commandlistitemname <> GUICtrlRead($commandlist) Then $commandlistitemname = GUICtrlRead($commandlist) setform() EndIf if $sr = "on" Then gettext() compare() EndIfSleep(200)endifSleep(25)WEndExitFunc Start()$sr = "on"GUICtrlSetData($listenbutton, "End Listening")EndFuncFunc Stop()$sr = "off"GUICtrlSetData($listenbutton, "Begin Listening")EndFuncFunc setform() msgbox(0,IniRead($ini_file, GUICtrlRead($commandlist), "type", "NA"), GUICtrlRead($commandlist)) Select Case IniRead($ini_file, GUICtrlRead($commandlist), "type", "NA") = "Close Window" GUICtrlSetData(GUICtrlRead($commandlist), GUICtrlRead($commandlist)) GUICtrlSetData(GUICtrlRead($commandlist), IniRead($ini_file, GUICtrlRead($commandlist), "word", "NA")) GUICtrlSetData(GUICtrlRead($commandlist), IniRead($ini_file, GUICtrlRead($commandlist), "window", "NA")) Select Case IniRead($ini_file, GUICtrlRead($commandlist), "matchmode", "NA") = 1 GUICtrlSetData($radio1, $GUI_CHECKED) Case IniRead($ini_file, GUICtrlRead($commandlist), "matchmode", "NA") = 2 GUICtrlSetData($radio2, $GUI_CHECKED) Case IniRead($ini_file, GUICtrlRead($commandlist), "matchmode", "NA") = 3 GUICtrlSetData($radio3, $GUI_CHECKED) EndSelect Case IniRead($ini_file, GUICtrlRead($commandlist), "type", "NA") = "Run Program" GUICtrlSetData(GUICtrlRead($commandlist), GUICtrlRead($commandlist)) GUICtrlSetData(GUICtrlRead($commandlist), IniRead($ini_file, GUICtrlRead($commandlist), "word")) GUICtrlSetData(GUICtrlRead($commandlist), IniRead($ini_file, GUICtrlRead($commandlist), "window")) EndSelectEndFuncFunc Selectfile() $file = FileOpenDialog ( "Select File", @ScriptDir, "All Files (*.*)", 1, "" ) if @error Then Return "" Return $fileEndFuncFunc export() $file = FileSaveDialog ( "Export INI File", @ScriptDir, "INI Files (*.ini)", 16, "default.ini" ) if @error = 1 Then Return $ini_file = $file EndFuncFunc import() $file = FileOpenDialog ( "Import INI File", @ScriptDir, "INI Files (*.ini)", -1, "default.ini" ) if @error = 1 Then Return $ini_file = $fileEndFuncFunc DeleteCommand() IniDelete ( $ini_file, GUICtrlRead($commandname) ) EndFuncFunc TestCommand() Select Case $command = "Close Window" WinKill ( GUICtrlRead($Window) ) Case $command = "Run Program" Opt("RunErrorsFatal", 0) Run( GUICtrlRead($runpath) ) Opt("RunErrorsFatal", 1) Case $command = "Send Keys" $sendspeedtext = Guictrlread($sendspeed) AutoItSetOption ( "SendKeyDelay", $sendspeedtext) sleep(500) $sendpath = Guictrlread($sendfilepath) if FileExists(GUICtrlRead($sendfilepath)) Then Send( FileRead(GUICtrlRead($sendfilepath)) ) $sendtext = Guictrlread($editbox) send( Guictrlread($editbox) ) GUICtrlSetData($sendfilepath, $sendpath) GUICtrlSetData($editbox, $sendtext) GUICtrlSetData($sendspeed, $sendspeedtext) $command = "" Case $command = "Run Command" Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & '"' & GUICtrlRead($RunCommand) & '"') $command = "" Case $command = "Text To Speech" tts_test() EndSelectEndFuncFunc tts_test() Select case GUICtrlRead($ttsvoicecombo) = "Select A Voice" $voicenumber = 0 Case GUICtrlRead($ttsvoicecombo) = "Anna" $voicenumber = 0 Case GUICtrlRead($ttsvoicecombo) = "Mary" $voicenumber = 1 Case GUICtrlRead($ttsvoicecombo) = "Mike" $voicenumber = 2 Case GUICtrlRead($ttsvoicecombo) = "Sam" $voicenumber = 3 EndSelect Select Case GUICtrlRead($ttsspeakcombo) = "Edit Box" $tts_text = GUICtrlRead($ttsedit) Case GUICtrlRead($ttsspeakcombo) = "Time" $tts_text = "The Time is now " & @HOUR & @MIN Case GUICtrlRead($ttsspeakcombo) = "CPU Load" $mem = MemGetStats() $tts_text = "The CPU Load is " & $mem[0] & " percent" EndSelect Local $o_speech = ObjCreate ("SAPI.SpVoice") $voice = $o_speech.GetVoices().Item($voicenumber) $o_speech.Voice = $voice $o_speech.Speak ('<pitch middle="'& GUICtrlRead($ttspitchtext) &'"><rate speed="'& GUICtrlRead($ttsspeedtext) &'">' & $tts_text & '</rate></pitch>', 8)EndFuncFunc SaveAdd() Select Case $command = "Close Window" IniDelete ( $ini_file, GUICtrlRead($commandname) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "word", GUICtrlRead($Word) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "type", $command ) IniWrite ( $ini_file, GUICtrlRead($commandname), "window", GUICtrlRead($Window) ) Select Case $GUI_CHECKED = GUICtrlRead($radio1) $match = 1 Case $GUI_CHECKED = GUICtrlRead($radio2) $match = 2 Case $GUI_CHECKED = GUICtrlRead($radio3) $match = 3 case Else $match = 1 EndSelect IniWrite ( $ini_file, GUICtrlRead($commandname), "matchmode", $match ) Case $command = "Run Program" IniDelete ( $ini_file, GUICtrlRead($commandname) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "word", GUICtrlRead($Word) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "type", $command ) IniWrite ( $ini_file, GUICtrlRead($commandname), "path", GUICtrlRead($runpath) ) Case $command = "Send Keys" IniDelete ( $ini_file, GUICtrlRead($commandname) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "word", GUICtrlRead($Word) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "type", $command ) IniWrite ( $ini_file, GUICtrlRead($commandname), "speed", GUICtrlRead($sendspeed) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "keys", GUICtrlRead($editbox) ) Case $command = "Run Command" IniDelete ( $ini_file, GUICtrlRead($commandname) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "word", GUICtrlRead($Word) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "type", $command ) IniWrite ( $ini_file, GUICtrlRead($commandname), "command", GUICtrlRead($RunCommand) ) Case $command = "Text To Speech" IniDelete ( $ini_file, GUICtrlRead($commandname) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "word", GUICtrlRead($Word) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "type", GUICtrlRead($command )) IniWrite ( $ini_file, GUICtrlRead($commandname), "voice", GUICtrlRead($ttsvoicecombo) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "speed", GUICtrlRead($ttsspeedtext) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "pitch", GUICtrlRead($ttspitchtext ) IniWrite ( $ini_file, GUICtrlRead($commandname), "speaktype", GUICtrlRead($ttsspeakcombo) ) IniWrite ( $ini_file, GUICtrlRead($commandname), "speaktext", GUICtrlRead($ttsedit) ) EndSelect $ini_sections = IniReadSectionNames ( $ini_file ) For $i = 1 To $ini_sections[0] $commandlistitems = $ini_sections[$i] & "|" & $commandlistitems Next GUICtrlSetData( $commandlist, "") GUICtrlSetData( $commandlist, $commandlistitems) $commandlistitems = ""EndFuncFunc gettext()RunWait(@ScriptDir & "\write.exe") $file = FileOpen ( "heard.txt", 0 ) $recog = FileRead ($file ) FileClose ( $file ) $file = FileOpen ( "heard.txt", 2 ) FileWrite ($file, "") FileClose ( $file ) EndFuncFunc compare()if $recog = "exit" Then exitif $recog = "stop" Then stop()EndFuncfunc changecommand() ;Run Program|Close Window|Run Command|Text To Speech|Send Keys GUICtrlDelete($ttsvoicecombo) GUICtrlDelete($ttsspeedlabel) GUICtrlDelete($ttsspeakcombo) GUICtrlDelete($ttsspeedtext) GUICtrlDelete($ttspitchlabel) GUICtrlDelete($ttspitchtext) GUICtrlDelete($ttsspeakcombo) GUICtrlDelete($ttsedit) GUICtrlDelete($Group3) GUICtrlDelete($Radio1) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($sendfilepath) GUICtrlDelete($sendspeed) GUICtrlDelete($Input5) GUICtrlDelete($editbox) GUICtrlDelete($from_file) GUICtrlDelete($runbrowse) GUICtrlDelete($runpath) GUICtrlDelete($RunCommand) GUICtrlDelete($Window) GUICtrlDelete($quotelabel) Select Case $command = "Close Window" ;radio checked if = to 1 $Group3 = GUICtrlCreateGroup("Title Match", 352, 128, 233, 177) $Radio1 = GUICtrlCreateRadio("Match from the start", 368, 208, 209, 25) $Radio2 = GUICtrlCreateRadio("Match any substring", 368, 240, 145, 17) $Radio3 = GUICtrlCreateRadio("Match exactly", 368, 264, 137, 25) GUICtrlSetState ($radio1,$GUI_CHECKED) $Window = GUICtrlCreateInput("", 360, 168, 217, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "Window name to close") Case $command = "Run Program" $runpath = GUICtrlCreateInput("", 424, 128, 177, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "Program path") $runbrowse = GUICtrlCreateButton("Browse", 344, 128, 75, 25, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "Click Here to Browse for a program to run") Case $command = "Send Keys" $editbox = GUICtrlCreateedit($sendtext, 360, 128, 241, 113, $ES_AUTOVSCROLL, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "Text to send") $from_file = GUICtrlCreateButton("From File", 360, 280, 89, 25, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "File to send keys from") $sendfilepath = GUICtrlCreateInput($sendpath, 464, 280, 137, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "Path of file") GUICtrlCreateLabel("Send Speed:", 424, 251, 66, 17) $sendspeed = GUICtrlCreateInput($sendspeedtext, 496, 248, 30, 21, $ES_NUMBER, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "Speed of key presses (default 5)") Case $command = "Run Command" $quotelabel = GUICtrlCreateLabel("Do Not Use Quotes", 355, 155, 200, 25) $RunCommand = GUICtrlCreateInput($RunCommanddata, 208, 168, 393, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) Case $command = "Text To Speech" $ttsvoicecombo = GUICtrlCreateCombo("", 360, 120, 97, 21) GUICtrlSetData(-1, "Select A Voice|Anna|Mike|Mary|Sam", "Select A Voice") $ttspitchlabel = GUICtrlCreateLabel("Pitch:", 464, 120, 31, 17) $ttspitchtext = GUICtrlCreateInput($ttspitch, 496, 120, 33, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "-20 to 20") $ttsspeedlabel = GUICtrlCreateLabel("Speed:", 536, 120, 38, 17) $ttsspeedtext = GUICtrlCreateInput($ttsspeed, 576, 120, 25, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetTip(-1, "-10 to 10") $ttsspeakcombo = GUICtrlCreateCombo("", 424, 152, 125, 21) GUICtrlSetData(-1, "Select What To Say|Edit Box|Time|CPU Load", "Select What To Say") $ttsedit = GUICtrlCreateEdit($ttseditdata, 368, 192, 233, 97, $ES_AUTOVSCROLL, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) EndSelectGuiSetState()EndFuncFunc OnAutoItExit ( )$intro = GUICreate("", 618, 499, @DesktopWidth/4.5, @DesktopHeight/4.5, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_STATICEDGE))GUISetBkColor(0x000080)GUICtrlCreateLabel("Voice Commander", 40, 192, 538, 80)GUICtrlSetFont(-1, 48, 800, 0, "Highlight LET")GUICtrlSetBkColor(-1, 0x000080)GUICtrlCreateLabel("By: Jsammarco@gmail.com", 312, 312, 264, 32)GUICtrlSetFont(-1, 16, 800, 0, "Palatino Linotype")GUICtrlSetBkColor(-1, 0x000080)GUICtrlCreateLabel("zerocool60544", 352, 352, 180, 41)GUICtrlSetFont(-1, 20, 800, 0, "Palatino Linotype")GUICtrlSetBkColor(-1, 0x000080)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 500, "long", 0x00080000);fade-inSleep(1000)DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $intro, "int", 500, "long", 0x00050010);implodeEndFuncplease post what you think or what you have doneThank YouP.S. I really don't want posts that just say, "I got an error, what do I do" [center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center] Link to comment Share on other sites More sharing options...
Zibit Posted August 7, 2009 Share Posted August 7, 2009 fail... i think you forgot to declare a few things.... get undeclared item's did you even test it ? ( before releaseing ) Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Link to comment Share on other sites More sharing options...
Szhlopp Posted August 7, 2009 Share Posted August 7, 2009 fail... i think you forgot to declare a few things.... get undeclared item's did you even test it ? ( before releaseing ) He said it's unfinished... @OP Where do you get Write.exe? What is it? Also, I tried to do this with the other InProcRecoContext object and it's not going to good. I think it could possibly be better in the end as it doesn't pop up the silly recognition deal. If you wouldn't mind taking a look: http://msdn.microsoft.com/en-us/library/ms722528(VS.85).aspx Seems to generally make sense to me. I can't for the life of me get this part to work: ObjCreate("SAPI.SpAudioPlug") Errors and doesn't create an object. I'm pretty new to using Objects in Autoit, hoping it's me that's the problem. $AudioPlugIn = ObjCreate("SAPI.SpAudioPlug") MsgBox(0, "", "BAH " & IsObj($AudioPlugIn)) Thanks RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
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