Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0
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 LoadCustomTagHandlers(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 = "";
}
}
Posted 21-Oct-12 14:46pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 120
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,611
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 21 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100