What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Request for Random Phrase Generator

Request for Random Phrase Generator
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Request for Random Phrase Generator
Oddly enough I just happen to write one, it was a quick hack job as I wanted something in my PSM every time I logged in.

The PSM will be reverted to the original when signing out, if the quote is too long it will wait 5 seconds before getting a new one (so it wont bog down messenger). like i said it is a quick hack job. Feel free to change it. I know this isn't what you wanted per say but meh.

code:
var oldPSM;

function OnEvent_Initialize(MessengerStart){
    try {
        oldPSM = Messenger.MyPersonalMessage;
        GetQuote();
    } catch (err) {}
}

function OnEvent_SigninReady(sEmail) {
    OnEvent_Initialize(true);
}

function OnEvent_Signout() {
    Messenger.MyPersonalMessage = oldPSM;
}

function OnEvent_Uninitialize() {
    OnEvent_Signout();
}

function GetQuote() {
    var sUrl = 'http://www.quotedb.com/quote/quote.php?action=random_quote_rss&=&=&';
    Interop.Call('wininet.dll', 'DeleteUrlCacheEntryW', sUrl);
   
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open('GET', sUrl, false);
    xmlhttp.send();
    var sString = xmlhttp.responseText;
   
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.loadXML(sString);
    var myNewPSM = xmlDoc.selectNodes('/rss/channel/item/description/text()')[0].text + ' - ' +xmlDoc.selectNodes('/rss/channel/item/title/text()')[0].text;
    Debug.Trace(myNewPSM);
    if (myNewPSM.length > 129) MsgPlus.AddTimer('x', 5000);
    else Messenger.MyPersonalMessage = myNewPSM;
}

function OnEvent_Timer(sTimerId) {
    GetQuote();
}
07-27-2007 04:03 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Request for Random Phrase Generator - by FaLCo on 07-27-2007 at 02:35 AM
RE: Request for Random Phrase Generator - by matty on 07-27-2007 at 04:03 AM
RE: Request for Random Phrase Generator - by stu on 07-27-2007 at 03:27 PM
RE: Request for Random Phrase Generator - by Nathan on 07-27-2007 at 03:35 PM
RE: Request for Random Phrase Generator - by Ezra on 07-27-2007 at 06:46 PM
RE: Request for Random Phrase Generator - by matty on 07-28-2007 at 03:03 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