code:
var online;
var offline;
var percent;
var str;
var oldPSM;
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);
oldPSM = Messenger.MyPersonalMessage
}
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("-","");
}
percent2 = Math.round(100 - percent);
for(var i=0;i<percent;i++){
str=str.replace("-","|");
}
for(var a=0;a<=100;a++){
str=str.replace("-","");
}
str=str+" "+percent+"% dos contatos Online ("+online+"/"+offline+")";
var psm = Messenger.MyPersonalMessage;
Messenger.MyPersonalMessage = oldPSM + " -" + str;
Debug.Trace(Email +" caused PSM to update");
}
This will only show the PSM when the script was started + str though