AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Aiml Custom Tag
 
 

I am trying to create and impliment a Custom Tag using the steps below.
I am having trouble with # 8.
Could someone show me how and where to create a method and call the LoadCustomTagHandlees(string pathToDLL)
Any help will be greatly appreciated

(1) Create a new library project to contain your Custom tag Classes.
(2) Add the AIMLbot dll as reference to your project.
(3) Create a public class with the same name as the tag you wish to handle.
(4) Reference System.Xml and AIMLbot.Utils.
(5) Add the [CustomTag] attribute to the class.
(6) Create a default Constructor that puts something in the “this.inputString” attribute.
(7) Override the ProcessChance() method.
(8) Finally to load the dll into your bot call the loadCustomTagHandlers(string pathToDLL) method of the AIMLbot.bot object that is your bot. An exception will be raised if you attempt to duplicate tag handling.

(This is the Custom Tag)
using system;
using system.Xml;
using Aimlbot.utils;

namespace SearchWebTags
{
[CustomTag]
public class searchWeb : AIMLTagHandler
{
public searchWeb()
{
this.inputString = "searchWeb";
}
protected override string ProcessChange()
{
if (this.templateNode.Name.ToLower() == "searchWeb")
{

{
string uri;
string searchString = this.Text1.Text;
uri = "http://www.google.com/search?q=" + searchString;
{
System.Diagnostics.Process.Start(uri);
}
  }
return String.Empty;
}
}
}


(The code below is my App)

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

using AIMLbot;
using AIMLbot.AIMLTagHandlers;
using AIMLbot.Normalize;
using AIMLbot.Utils;

using System.Speech.Synthesis;
using SpeechLib;
using SearchWebTags;

namespace MyAimlBot1
{

public partial class MyAimlBot1: System.Windows.Forms.Form
{
SpeechLib.SpVoice say;

private cBot myBot;

public MyAimlBot1()
{
InitializeComponent();
pictureBox1.Image = Properties.Resources.Mth_0;
say = new SpeechLib.SpVoice();

myBot = new cBot(false);


this.textBox1.KeyPress += new KeyPressEventHandler(this.textBox1_KeyPress);
}
     
       
      private void MyAimlBot1_Load(object sender, EventArgs e)
      {

}
     
     
      private void textBox1_KeyPress(object sender, 
      System.Windows.Forms.KeyPressEventArgs e)
      {
say = new SpeechLib.SpVoice();

if (e.KeyChar == 13)
{
this.richTextBox1.Text=this.richTextBox1.Text;

cResponse reply = myBot.chat(this.textBox1.Text, "user");
this.richTextBox1.Text= reply.getOutput();

say.Speak(this.richTextBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
say.Viseme += new
SpeechLib._ISpeechVoiceEvents_VisemeEventHandler(say_Viseme);
this.textBox1.Text = "";
}
      }

 

 
  login or register to react
‹‹ Some issues      Tag a tweet ››