Hi
Sorry if you already know this. I found it last week and haven't been able to stop playing with it yet.
I know it works on Windows XP, I haven't had a chance to try it on other versions of Windows.
There are a few examples in there that show some of what can be done. You can download other voices from the MS website:
The Microsoft Anna voice sounds really great and comes with Vista and some other MS Applications (possibly Office 2003 and/or AutoRoute/MapPoint 2006.
Sorry if you already know this. I found it last week and haven't been able to stop playing with it yet.
I know it works on Windows XP, I haven't had a chance to try it on other versions of Windows.
Code:
'Create Object
Set objVoice = CreateObject("SAPI.SpVoice")
Const SVSFlagsAsync = 1
Const SSFMCreateForWrite = 3
'Basic speech
objVoice.Speak "Hello I am talking to you"
'Speech while continuing with the rest of the script.
'(warning, if the script finished before the speech, the speech will stop)
objVoice.Speak "You should see a message box, while I am talking", SVSFlagsAsync
MsgBox "This is the message box that I mentioned."
'List voices that are installed.
For Each strVoice in objVoice.GetVoices
Wscript.Echo strVoice.GetDescription
Next
'Change voice (these may not work if you don't have these voices installed).
Set objVoice.Voice = objVoice.GetVoices("Name=Microsoft Anna").Item(0)
objVoice.Speak "Hi, this is Microsoft Anna."
Set objVoice.Voice = objVoice.GetVoices("Name=Microsoft Sam").Item(0)
objVoice.Speak "And this is Microsoft Sam"
'Record speech to a WAV file
Set objFile = CreateObject("SAPI.SpFileStream.1")
objFile.Open "C:\Record.wav", SSFMCreateForWrite
Set objVoice.AudioOutputStream = objFile
objVoice.Speak "This text will be recorded to be played back later"
There are a few examples in there that show some of what can be done. You can download other voices from the MS website:
The Microsoft Anna voice sounds really great and comes with Vista and some other MS Applications (possibly Office 2003 and/or AutoRoute/MapPoint 2006.