Visit Map

Friday, April 22, 2005

Using Microsoft Agent from .NET

Download the microsoft agent from http://www.microsoft.com/msagent/default.asp. If not present at /msagent\chars
Add a reference to Microsoft Agent server using tools - references - Microsoft Agent server 2.0
Here is the code

IAgentCtlCharacterEx Genie;
Keep a textbox on form and a button in the button click keep the following code

IAgentCtlCharacterEx Genie;
if(textBox1.Text!="")
{
Agent1=new AgentClass();
try
{
Agent1.Connected = true;
string strPath=ConfigurationSettings.AppSettings.Get("path").ToString();
//strPath is /msagent\chars
Agent1.Characters.Load("Merlin",strPath);
Genie=Agent1.Characters.Character("Merlin");
Genie.Show(true);
Genie.Speak(textBox1.Text,"");
}
catch(Exception ex)
{
throw ex;
}


This is just an idea to share

No comments: