Sign in to follow this  
Followers 0
MrSpacely

javascript onEvent

1 post in this topic

#1 ·  Posted (edited)

I tried doing something using object to load a webpage with a java applet on it.

works fine but no i want to use the applets events

The java applet is a chat applet and comes with a onEvent script

wich can capture text(send by other chatters) and a few other things

//note this is javascript a part of the script wich I got with it
function onEvent()
{
    eventID = arguments[0];
    attributes = new Array();

    for (i=1;i<arguments.length;i+=2)
    { 
        attributes[attributes.length] = new Attribute(arguments[i], arguments[i+1]);
    }
    for (i=0;i<listeners.length;i++)
    {
        listeners[i].onEvent(eventID, attributes);
    }
    if (debug)
    {
        for (i=0;i<attributes.length;i++)
        {
            attribute = attributes[i];
            alert('Event ID: '+eventID+'\n\nAttribute ID: '+attribute.id+'\nAttribute Value: '+attribute.value);
        }
    }
    switch(eventID)
    {
        case 4: // KILLEDCHANNEL
            if(chat.getRejoinOnChannelKill())
            {
                for (i=0;i<attributes.length;i++)
                {
                    attribute = attributes[i];
                    if (attribute.id == 12)
                        killedkanaal = attribute.value;
                }
                setTimeout('chat.setMyChannel(killedkanaal)',150);
            }
        break;

I was wondering what information I would need to capture these events with autoit

using ObjEvent() function system

Does anyone know what I need to get the same information as the onEvent function can gather in the browser

Litlle test script to try out the event capture but ofcourse it doesn't work because

I donot know verry much about com objects

#include <IE.au3>
WinActivate ( "TMF Chatbox")

$chatwin = _IEAttach("TMF")
_IELoadWait($chatwin)

$chat = _IEFrameGetObjByIndex($chatwin,1)
$chat1 = $chat.document.applets("chat")

$blaat2 = ObjEvent($chat1,"blaat_")


While 1
Wend

Func blaat_onEvent()
msgbox(0,"",$blaat2)
endfunc

Because i understood javascript a bit I could make it send possibility like:

I can allready send messages to the applet like using

$chat1.input($chat1.getMyChannel,"something",0,$chat1.getMyName)

wich can send any command and text normally being typed in the input box

also setchannel and other stuf works but thats only one way no answer

But I checked the java there is no function to get data like the chat text or anything else besides my currect channel or nickname.

It must be done with ObjEvent but how is not clear yet

Edited by MrSpacely

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0