What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [request] Dictionary/Wiki/Urban Dictionary Script

[request] Dictionary/Wiki/Urban Dictionary Script
Author: Message:
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [request] Dictionary/Wiki/Urban Dictionary Script
I have this script for wikipedia with me. It works only when you send the message. If you want, i can edit it again to make it respond to other's messages too.
code:
//Wikipedia Search Script, originally created by Paril, modified by ddunk.
//Edited by Felu(http://www.feluowns.com) for personal use.

var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
var query;
var CurrentWindow;
var url;
var title;
var response;
var result;

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{   
    if(sMessage.substr(0,5) == "!wiki")
    {
        CurrentWindow = pChatWnd;
        query = sMessage.substr(6,sMessage.length);
        get_wikipedia_result(query);
        return "";       
    }
}


function get_wikipedia_result(query)
{
    xmlHttp.open("GET", "http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=" + query + "&fulltext=Search", true);
    xmlHttp.onreadystatechange = stateChanged;
    xmlHttp.send();
}       

function stateChanged()
{
    Debug.Trace(xmlHttp.readyState)
    if (xmlHttp.readyState==4)
    {
        Debug.Trace(xmlHttp.status)
        if (xmlHttp.status==200)
        {
            Debug.Trace("test")
            url = new RegExp("<li style=\"padding-bottom: 1em;\"><a href=\"(.*?)\"");
            title = new RegExp("<li style=\"padding-bottom: 1em;\"><a href=\".*?\" title=\"(.*?)\">");
            response = xmlHttp.responseText;
            result = response.match(url);
            title = response.match(title);
            if (result)
            {               
                CurrentWindow.SendMessage("Wikipedia search: " + query + "\n Result: " + title[1] + " - http://en.wikipedia.org" + result[1]);
            }
            else
                CurrentWindow.SendMessage("Wikipedia search for " + query + " returned no results");
        }
    }
}
04-05-2007 04:09 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[request] Dictionary/Wiki/Urban Dictionary Script - by muffinz on 04-05-2007 at 02:11 AM
RE: [request] Dictionary/Wiki/Urban Dictionary Script - by Rolando on 04-05-2007 at 03:59 AM
RE: [request] Dictionary/Wiki/Urban Dictionary Script - by Felu on 04-05-2007 at 04:09 AM
RE: [request] Dictionary/Wiki/Urban Dictionary Script - by muffinz on 04-05-2007 at 11:52 AM
RE: [request] Dictionary/Wiki/Urban Dictionary Script - by muffinz on 04-05-2007 at 12:23 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On