SSIP for Windows as a COM server

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: ProgrammingBlind@xxxxxxxxxxxxx
  • Date: Wed, 13 Feb 2008 05:10:40 -0500 (EST)

I may have found why the COM version was not working.  It needs to be
installed in the global assembly cache of the .NET Framework -- otherwise
a copy would be needed in the directory of each executable that used it.
Here are steps that worked for me (where utilities of the .NET 2.0 SDK are
on the search path).

In AssemblyInfo.cs, comment out these two lines as follows:
//[assembly: AssemblyKeyFile("")]
//[assembly: AssemblyKeyName("")]

Change false to true in the line as follows:
[assembly: ComVisible(true)]

Uncomment the line as follows:
 [assembly: Guid("49a5c035-e8c5-46b0-8317-499b7bc5e511")]


In order to install an assembly in the global assembly cache, it must be
signed with a strong name key.  Create such a key file on the command line
as follows:
sn.exe /k SSIPClient.key

The following batch file, build.bat, creates the assembly, and registers
it as a COM server for any client on the computer

@echo off
cls
rem Uninstall previous version from the global assembly cache
gacutil.exe /nologo /uf SSIPClient

rem Unregister previous version as a COM server
regasm.exe /nologo /u SSIPClient.dll

rem Compile new version from source files
csc.exe /nologo /keyfile:SSIPClient.key /t:library /out:SSIPClient.dll
AssemblyInfo.cs GetOpt.cs KeysUtils.cs SSIPClient.cs SSIPLogger.cs
SSIPResponse.cs TextUtils.cs

rem Register it as a COM server
regasm.exe /nologo /tlb SSIPClient.dll

rem Verify the integrity of the assembly
peverify.exe /nologo SSIPClient.dll

rem Install it to the global assembly cache
gacutil.exe /nologo /if SSIPClient.dll


The following is a session with Interactive JScript that demonstrates the
COM capability:

> oVoice = comCreate("SSIP4Windows.Client")
SSIP.Client.SSIPClient

> oVoice.Connect()
>oVoice.IsConnected
True

> oVoice.SpeechAPI
AUTO

> aAPIs = oVoice.APIs
System.Collections.ArrayList

> aAPIs.Count
3

> for (s in aAPIs) output(s)
JAWS
WINEYES
SAPI

> sText = "Hello world"
Hello world

> oVoice.SayImportant(sText)

> oVoice.Close()
> oVoice.IsConnected
False


On the other hand, the following VBScript program seems to crash the voice
server I have not figured out why.  It may be run at the command line as
follows:
cscript.exe /nologo hello.vbs

Dim oVoice
Set oVoice = CreateObject("SSIP4Windows.Client")
oVoice.Connect()
WScript.Sleep(1000)
oVoice.SayImportant("Hello world")
WScript.Sleep(1000)
oVoice.Close()
Set oVoice = Nothing


Jamal

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: