Works fine for me.... This script should be better
code:
function OnEvent_Initialize(MessengerStart) {
shell=new ActiveXObject("WScript.Shell");
if (MessengerStart==false) {
regPath=MsgPlus.ScriptRegPath+Messenger.MyUserId+'\\';
Initialize();
}
}
function OnEvent_Signin(Email) {
regPath=MsgPlus.ScriptRegPath+Messenger.MyUserId+'\\';
Initialize();
}
function OnEvent_Signout(Email) {
MsgPlus.CancelTimer("Timer");
}
function OnEvent_Uninitialize(MessengerExit) {
MsgPlus.CancelTimer("Timer");
}
function OnEvent_Timer(TimerId) {
seconds+=10
shell.RegWrite(regPath+"Seconds",seconds);
yr=Math.floor(seconds/31536000);
mon=Math.floor((seconds-(yr*31536000))/2592000);
day=Math.floor((seconds-((yr*31536000)+(mon*2592000)))/86400);
hr=Math.floor((seconds-((yr*31536000)+(mon*2592000)+(day*86400)))/3600);
min=Math.floor((seconds-((yr*31536000)+(mon*2592000)+(day*86400)+(hr*3600)))/60);
secs=Math.floor((seconds-((yr*31536000)+(mon*2592000)+(day*86400)+(hr*3600)+(min*60))));
if (secs>0) {SECONDS=" "+secs+" seconds";}
else {SECONDS="";}
if (min==1) {MINS=" "+min+" minute";}
else if (min>1) {MINS=" "+min+" minutes";}
else {MINS="";}
if (secs!=0&&min>0) {
MINS+=" and"
}
if (hr==1) {HRS=" "+hr+" hour";}
else if (hr>1) {HRS=" "+hr+" hours";}
else {HRS="";}
if (day==1) {DAYS=" "+day+" day";}
if (day>1) {DAYS=" "+day+" days";}
else {DAYS="";}
if (mon==1) {MONTH=" "+mon+" month";}
else if (mon>1) {MONTH=" "+mon+" months";}
else {MONTH="";}
if (yr==1) {YEAR=" "+yr+" year";}
if (yr>1) {YEAR=" "+yr+" years";}
else {YEAR="";}
MsgPlus.AddTimer("Timer",10000);
Messenger.MyPersonalMessage="I've been connected for"+YEAR+MONTH+DAYS+HRS+MINS+SECONDS;
}
function Initialize() {
try {seconds = parseInt(shell.RegRead(regPath+"Seconds"));} catch(err) {seconds=0;}
MsgPlus.AddTimer("Timer",10000);
}
Thanks for the translation NiteMare
Note : " "+secs+" seconds" >> I could put the space at the end, but the pm will be ".... 20 seconds "<< I don't want this space here ! xD