Update:: xAP Speech does NOT use msagent. No wonder it wouldn't work. I'll leave this page because it is a good introduction to scripting msagent.

I found myself troubleshooting msagent on win2k for the xAP Speech application. It would not initialize on win2k so I decided to make 100% sure that I had msagent installed correctly. I didn't... But I did finally install all the components and even write a test script. This page contains my notes on how I did this.

It is interesting to note that even after I had all this working xAP Speech still would not initialize properly.

MS Agent Installation

MS Agent Installation Instructions - I downloaded and installed everything even though some of it might have already been installed; I now have a "speech" control panel item
msagent - main MS page for msagent

Permissions Issues

I also run as a limited user and needed to follow these instructions to open up the permissions on the TTS registry entries:
Deploying the TTS3000 text-to-speech engines for non-Administrator users

VBScript Test Code

I found a great walk through of scripting msagent: Microsoft Agent: Teach Your Scripts to Talk
There is one problem with this entire tutorial. It assumes that the windows directory is c:\windows. I'm running win2k so my windows directory is c:\winnt. I had to add some code to retrieve the correct windows directory path. google is my friend (along with all those out there that post little pearls of wisdom). Below is the script code that I finally ended up with:

Const WINDOWS = &H24&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(WINDOWS)
Set objFolderItem = objFolder.Self
strWinFolder = objFolderItem.Path   ' C:\WINNT or C:\WINDOWS

strAgentName = "Merlin"
'strAgentPath = "C:\WINNT\Msagent\Chars\" & strAgentName & ".acs"
strAgentPath = strWinFolder & "\Msagent\Chars\" & strAgentName & ".acs"
Wscript.Echo strAgentPath

Set objAgent = CreateObject("Agent.Control.2")

objAgent.Connected = TRUE
objAgent.Characters.Load strAgentName, strAgentPath
Set objCharacter = objAgent.Characters.Character(strAgentName)

objCharacter.Play "GetAttention"
objCharacter.Speak "Hello, how are you?"
objCharacter.Speak "I'm going now. Goodbye."

Do While objCharacter.Visible = TRUE
    Wscript.Sleep 250

Contributors to this page: michael .
Page last modified on Thursday 06 of September, 2007 23:01:32 CDT by michael.