Jump to content

Speak


Jussip
 Share

Recommended Posts

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
Link to comment
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]

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...