Sign in to follow this  
Followers 0
Jussip

Speak

5 posts in this topic

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

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

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


When the words fail... music speaks

Share this post


Link to post
Share on other sites

should use object error handling also

If Not IsObj($Speech) then....

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

should use object error handling also

If 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 by KabirSoftInc

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0