[request] Dictionary/Wiki/Urban Dictionary Script - 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: [request] Dictionary/Wiki/Urban Dictionary Script (/showthread.php?tid=73315)
[request] Dictionary/Wiki/Urban Dictionary Script by muffinz on 04-05-2007 at 02:11 AM
Greetings to all the scripting gurus out there.
Would such a script be possible? I recall coming across irc bots that were scripted do this.
e.g. !define frog
This would draw up the definition of frog from an online dictionary which is concise and not too long winded.
e.g. !wiki frog
Provides a short description of the requested word from Wikipaedia and a link to it.
e.g. !slang technosexual
Provides the definition of the slang requested from Urban Dictionary.com perhaps the definition that has received the most thumbs up
Just my 2 cents, I thought that these scripts would make msn live more fun!
RE: [request] Dictionary/Wiki/Urban Dictionary Script by Rolando on 04-05-2007 at 03:59 AM
spleak can do this. spleak@hotmail.com.. unless you want a script.. I'm sure another member will look into it if that's what you want.
RE: [request] Dictionary/Wiki/Urban Dictionary Script by Felu on 04-05-2007 at 04:09 AM
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");
}
}
}
RE: [request] Dictionary/Wiki/Urban Dictionary Script by muffinz on 04-05-2007 at 11:52 AM
yes! Felu it would be great if other people could make use of the !wiki search function as well.
I'm not familiar with creating scripts, but I'll try to create one using your code and hope everything goes well. Thanks!!
RE: [request] Dictionary/Wiki/Urban Dictionary Script by muffinz on 04-05-2007 at 12:23 PM
okay i have just created it and its running fine now.
keyword entered: !wiki frog
Answer provided:
Wikipedia search: frog
Result: Frogs - http://en.wikipedia.org/wiki/Frogs
I was hoping that a short description could be added to that..
e.g.
keyword entered: !wiki frog (This would show up on chat to show that someone has requested a search)
Answer Provided:
Wikipedia search: frog
Archaeobatrachia Mesobatrachia Neobatrachia - List of Anuran families The frog is an amphibian in the order Anura (meaning "tail-less" from Greek an-, without + oura, tail), formerly referred to as Salientia (Latin saltare, to jump). Adult frogs are characterised by long hind legs, a short body, webbed digits, protruding eyes and the absence of a tail. Most frogs...
http://en.wikipedia.org/wiki/Frogs to read more about it
saves from unnecessarily opening internet explorer window everytime a wikipedia search is done.
I've seen it on bots and was just wondering whether the exact script was created on msgplus.
Thanks again for the code Felu
|