Shoutbox

Accessing information from the internet - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Accessing information from the internet (/showthread.php?tid=78040)

Accessing information from the internet by ash44455666 on 10-07-2007 at 04:55 PM

I'm pretty sure it's possible, as I'm pretty sure I've seen similar tasks done by other scripts.  The problem is I don't know how they do it ^o)
Does anyone here know how to do this?  It is complicated?  If I confused you with what I'm trying to do, here's an example.

A user who is chatting with me types !google cough drops
The script somehow accesses/goes to/finds the first 3 matches of cough drops at
http://www.google.com/search?hl=en&q=cough+drops
and displays them on in the conversation.  Thanks to anyone who assists me :)


RE: Accessing information from the internet by Spunky on 10-07-2007 at 06:40 PM

There are already a few scripts about that do what you want. One of which being "+Search" created by me, that allows you to add multiple search engines.

[Release] +Search (Version 1.2)

If you still want to go ahead and make your own, you can edit the source code and look for code regarding XMLHTTP (Google how to use XMLHTTP and it will explain it in detail)


RE: Accessing information from the internet by ash44455666 on 10-07-2007 at 07:38 PM

Thank you, I'll take a look at your code and see what I can figure out.  The exact script I'm attempting to create is something for a game called RuneScape.  The commands would/will be !stats <username>, !quest <quest>, !clan <username> and maybe another or two.


RE: Accessing information from the internet by RaceProUK on 10-07-2007 at 08:26 PM

quote:
Originally posted by SpunkyLoveMuff
Google how to use XMLHTTP
And ensure that the info you look at relates to Internet Explorer.
RE: Accessing information from the internet by ash44455666 on 10-07-2007 at 11:51 PM

function search(query, engine){
    var shell = new ActiveXObject("WScript.Shell");
    engine=engine.split("TEST");
    query = query.replace(/\s/gi,"+");
    shell.run(engine[0]+query+engine[1]);
}

how does this function work?  I don't really need a detailed description of every line of code.  What does 'query' need to be?  Would that be the what you're searching for at google?  Also, what would 'engine' have to be?  Also, will this be the only function I need to use, disregarding something to filter out what I need?

Edit:  I just tried out your code, but it doesn't retrieve information from the internet, it just goes to the appropriate website on the default web browser.  This is useful in some cases, but what I'm trying to do is have the script get the required information itself and bring it back to be said in the conversation.  Is this possible?


RE: Accessing information from the internet by Spunky on 10-08-2007 at 02:12 AM

My bad... Thought it had the function in there... Got some spare time now so:

code:
function getInfo(){
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
        http_request.open('GET', "www.website.com", false);
        http_request.onreadystatechange = event;
        http_request.send();
}

function event(){
        if (http_request.readyState == 4) {
                if (http_request.status == 200) {
                        var response = http_request.responseText
            Debug.Trace(response);
            //Your code goes here
                    }
            }
    }


Sorry for the mix-up
RE: Accessing information from the internet by ash44455666 on 10-08-2007 at 02:15 PM

Thanks once more, that mostly solved my problem.  However when I got the information it was all in HTML (or XML, don't really know the difference).  Is there a particular way to extract the information I need?  I read about XMLHTTTP using a Google search, but all I really got was the information on obtaining the web page's content :|