What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Useful Snippets

Useful Snippets
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. Useful Snippets
I'm quite bored at the moment so I decided to share a couple of functions that seem to help me out a bit and save time.

This first one is because I was too used to using Flash's trace command. I also like that you can prefix (and suffix) the traced output.
code:
function trace(message){
Debug.Trace("Trace: "+message)
}


This one I deliberatley wanted to be similar to the VB function msgbox. Obviously, I've not given options to set buttons (I only use it for warnings etc)
code:
function msgbox(title, message){
Interop.Call("User32.dll", "MessageBoxW", 0, message, title, 0);
}


I saw a script that shows the percentage of online users so I decided to make a "graphical" version and thought I'd share it :p
code:
var online;
var offline;
var percent;
var str;

function OnEvent_SigninReady(Email){
doIt(Email);
}

function OnEvent_ContactSignin(Email){
doIt(Email);
}

function OnEvent_ContactSignout(Email){
doIt(Email);
}

function OnEvent_Initialize(MessengerStart){
doIt(Messenger.MyEmail);
}

function doIt(Email){
str="----------------------------------------------------------------------------------------------------";
online=0;
offline=0;
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
    for(; !e.atEnd(); e.moveNext()) {
        var Contact = e.item();
        if(Contact.Status!=1&&Contact.Status!=0){
            online++;
        }
            offline++;
       
    }

percent = Math.round((online/offline)*100);
    for(var i=0;i<percent;i++){
        str=str.replace("-","|");
    }
    for(var a=0;a<=100;a++){
        str=str.replace("-","");
    }
    str=str+"  "+percent+"% Online";
Messenger.MyPersonalMessage = str;
Debug.Trace(Email +" caused PSM to update");
}

This might not be "the best way" of doing things (like most of my scripts), but it gets the job done ;)

EDIT: The red segment has been revised due to a SLIGHT error ;)

This post was edited on 10-10-2006 at 12:31 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
10-10-2006 12:04 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Useful Snippets - by Spunky on 10-10-2006 at 12:04 AM
RE: Useful Snippets - by deAd on 10-10-2006 at 12:09 AM
RE: Useful Snippets - by Spunky on 10-10-2006 at 12:13 AM
RE: Useful Snippets - by MicroWay on 10-10-2006 at 12:28 AM
RE: Useful Snippets - by Spunky on 10-10-2006 at 12:30 AM
RE: Useful Snippets - by MicroWay on 10-10-2006 at 05:52 AM
RE: RE: Useful Snippets - by Spunky on 10-10-2006 at 10:07 AM
RE: Useful Snippets - by CookieRevised on 10-20-2006 at 11:03 PM
RE: Useful Snippets - by Spunky on 10-21-2006 at 12:10 AM
RE: Useful Snippets - by Ezra on 10-21-2006 at 12:33 AM


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