Re: SAPI5 speech via COM in AutoIt, VBNET, & C#

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Tue, 11 Sep 2007 11:43:37 -0400 (EDT)

In case it's of use to folks, I just posted an archive of SAPI5 help
converted to structured text at
http://www.empowermentzone.com/sapi_doc.zip

Jamal
On Tue, 11 Sep 2007, Octavian
Rasnita
wrote:

> Date: Tue, 11 Sep 2007 08:28:36 +0300
> From: Octavian Rasnita <orasnita@xxxxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: SAPI5 speech via COM in AutoIt, VBNET, & C#
>
> Hi Jamal,
>
> Here are some lines from your code:
>
> Local $oSapi = ObjCreate("SAPI.SpVoice")
> $oSapi.Speak($sText)
>
> Please tell me where can I found information about the syntax of the methods
> I can use and the types of objects like "SAPI.SpVoice" and "Speak".
>
> In the help of the most applications I couldn't find such information about
> them.
>
> Thanks.
>
> Octavian
>
> ----- Original Message -----
> From: "Jamal Mazrui" <empower@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Tuesday, September 11, 2007 6:06 AM
> Subject: SAPI5 speech via COM in AutoIt, VBNET, & C#
>
>
> > Below are example programs in three languages:  AutoIt, Visual Basic .NET,
> > and C#.  Each contains a Say routine to speak a string via COM automation
> > with SAPI5, as well as code to test that routine.  Initial comments give
> > command-line syntax for compiling and running the program -- assuming
> > relevant tools have been included on the Windows search path.
> >
> > Hope this helps,
> > Jamal
> > ----------
> >
> > ; AutoIt
> > ; Run sapi.au3 with the following command line:
> > ; start sapi.au3
> > ; or compile it with the following command line:
> > ; aut2exe /in sapi.au3
> > ; Then run sapi.exe
> >
> > Func Say($sText)
> > Local $oSapi = ObjCreate("SAPI.SpVoice")
> > $oSapi.Speak($sText)
> > $oSapi = 0
> > EndFunc
> >
> > Local $sText = "Testing 1 2 3"
> > Say($sText)
> >
> > ----------
> >
> > ' Visual Basic .NET
> > ' Compile sapi.vb with the following command line:
> > ' vbc.exe sapi.vb
> > ' Then run sapi.exe
> >
> > Module Program
> >
> > Sub Say(sText As String)
> > Dim sProgID As String = "SAPI.SPVoice"
> > Dim oSapi As Object = Microsoft.VisualBasic.CreateObject("SAPI.SPVoice")
> > oSapi.Speak(sText)
> > System.Runtime.InteropServices.Marshal.ReleaseComObject(oSapi)
> > End Sub
> >
> > Sub Main()
> > Dim sText As String = "Testing 1 2 3"
> > Say(sText)
> > End Sub
> >
> > End Module
> >
> > ----------
> >
> > // C#
> > // Compile sapi.cs with the following command line:
> > // csc.exe sapi.cs
> > // Then run sapi.exe
> >
> > class Program {
> >
> > static void Say(string sText) {
> > string sProgID = "SAPI.SPVoice";
> > System.Type tSapi = System.Type.GetTypeFromProgID(sProgID);
> > object oSapi = System.Activator.CreateInstance(tSapi);
> > string sMethod = "Speak";
> > object[] oArgs = {sText};
> > tSapi.InvokeMember(sMethod, System.Reflection.BindingFlags.InvokeMethod,
> > null, oSapi, oArgs);
> > System.Runtime.InteropServices.Marshal.ReleaseComObject(oSapi);
> > } // Say method
> >
> > static void Main() {
> > string sText = "Testing 1 2 3";
> > Say(sText);
> > } // Main method
> >
> > } // Program class
> >
> > ----------
> > End of Document
> >
> > __________
> > View the list's information and change your settings at
> > //www.freelists.org/list/programmingblind
> >
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: