Jussip Posted October 17, 2008 Posted October 17, 2008 It speaks for you! Well, tell me what you think; #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Speak = GUICreate("Speak", 184, 84, 193, 125) $Input1 = GUICtrlCreateInput("This is my first script", 8, 16, 153, 21) $Speak = GUICtrlCreateButton("Speak", 16, 48, 75, 25, 0) $Exit = GUICtrlCreateButton("Exit", 96, 48, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Speak _Talk(GuiCtrlRead($Input1)) Case $Exit exit EndSwitch WEnd Func _Talk($sText) $tempFile = @TempDir & '\talktemp.vbs' FileWriteLine($tempFile, 'Dim Talk' & @CRLF & _ 'Set Talk = WScript.CreateObject("SAPI.SpVoice")' & _ @CRLF & 'Talk.Speak "' & $sText & '"') RunWait('Wscript.exe talktemp.vbs', @TempDir) FileDelete($tempFile) EndFunc
MerkurAlex Posted October 17, 2008 Posted October 17, 2008 If i am not mistaken you are just calling a vb script you should search there is an AutoIt version of calling that api [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]
Andreik Posted October 18, 2008 Posted October 18, 2008 Func _Speak($TEXT,$VOICE="Sam",$VOLUME=50,$RATE=0,$WAIT=-1,$LANG_ID="Language=409") Local $Speech $Speech = ObjCreate("SAPI.SpVoice") $Speech.Rate = $RATE $Speech.Volume = $VOLUME $Speech.Voice = $Speech.GetVoices("Name=Microsoft " & $VOICE , $LANG_ID).Item(0) $Speech.Speak($TEXT) $Speech.WaitUntilDone($WAIT) $Speech = "" EndFunc
Valuater Posted October 18, 2008 Posted October 18, 2008 should use object error handling also If Not IsObj($Speech) then.... 8)
KabirSoftInc Posted October 20, 2008 Posted October 20, 2008 (edited) should use object error handling alsoIf Not IsObj($Speech) then....good idea, his script needs a update but it's still good for newbies to let them learn how this work. i really appreciate his work!6) Edited October 20, 2008 by KabirSoftInc
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