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..

Loking for sample of a Javascript interface to ProgramAB
 
 

I am trying to learn my way into a robust virtual agent interface to AIML 2.0.
It appeared javascript was a good place to start.
So I wrote an html page that loads the programAB.jar file,
then attempts to call multisentenceRespond passing “Hello” and displaying the response.
I am sure it can’t be this simple, but I cannot find an example that demonstrates
what I am missing.
Help!

Here is my starting point

<html>
  <
body>
    <
applet
      id
=“AI”
      archive
=“file:\\\\\\D:\\programAB\\lib\\ab.jar”
      code
=“org.alicebot.ab.Chat”>           
    </
applet>
     <
script type="text/javascript">
       var 
Request “Hello”;
       var 
response AI.multisentenceRespond(Request);
       
alert (response);
      
</script>             
  
</body>
</
html


Thanks,
Barry

[edit] Once again, I added the [ code ] tags to make the code more readable. Please use them in the future - Dave [/edit]

 

 
  [ # 1 ]

Ok, first off, if the file ab.jar is placed in the same folder as the HTML file that calls it, you can do away with the file:// protocol (which is incorrectly formatted anyway). Secondly, I don’t think that it’s quite that simple to access a Java applet in that manner. This page gives a couple of examples of how to access the functions and methods of a Java class, not a Java archive (JAR file), which may be completely different. There’s an in-browser version of Minecraft (link here…) that has the proper coding for using a Java applet that runs from a JAR file, but I haven’t really looked at the code for that page closely enough yet to give any really solid advice (busy guy today, I’m afraid). that said, however, you may be able to look over the code for that page and pick up some inspiration on your own. You can also read through the Program AB Wiki to perhaps get some ideas, or even search Google Groups to see what can be found there.

I think that’s enough info for now. If you need more, please feel to consult Google, Stack Overflow, and any Java community forums that you can find. smile

 

 
  [ # 2 ]

I appreciate the reply (and the edits couldn’t figure out how to prevent this forum from changing my code).  I have been researching this at many of the places you suggested for that last week.  This brought me back to this forum, reasoning that someone had done this already.

Directing me to the minecraft link may well get me moving in the right direction, but I just thought someone out there in the chatbot ether may have done this already.

Barry

 

 
  [ # 3 ]

text/javascript is missing the closing quote.

 

 
  [ # 4 ]

That’s my fault, actually. Oops?

 

 
  [ # 5 ]

Thanks again…I was told that language=javascript was no longer necessary but I have not seen the Type= parameter

 

 
  [ # 6 ]

“Your security settings have blocked an application from running
with an out-of-date or expired version of Java.”

I’m stopping here. The opportuniy cost just got too high.

(opportunity cost = lost opportunity to do something else.)

However, I will check back on any further progress made by Barry.

It should be cool when it geta all figured out.

 

 
  login or register to react