Shoutbox

Statistique 1.0en | Fixed English - 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: Statistique 1.0en | Fixed English (/showthread.php?tid=77129)

Statistique 1.0en | Fixed English by fishyghost on 08-31-2007 at 11:10 AM

Date Added:      Jun 16, 2007 02:30 PM
Creator:     Yassine ABID
Description:     With this script, you will be able to know how much message sent by each contact and which sent the maximum.

To know how much of message sent by the contact, open initially that fenestrates conversation, after click on the button script and click on "how much message sent by this contact" .

To know which sent the maximum of message and a number message to send by each contact, always click on the button script afterwards on the button "which sent the maximum number of message".

More Info:     http://membres.lycos.fr/yassineabid/

======================================

I noticed the grammatical mistakes, and fixed them.
Also, shortened lengthy menu commands.

Otherwise, unchanged from Yassine's version
**(Nothing too special I know)**

New code below:

code:
function OnGetScriptMenu(Location){
if (Location == 2){
var xmlMenu = new String();
xmlMenu += '<ScriptMenu>';
xmlMenu += '<MenuEntry Id="at">This Contact.</MenuEntry>';
xmlMenu += '<MenuEntry Id="max">Top Sender.</MenuEntry>';
xmlMenu += '</ScriptMenu>';
return xmlMenu;
}
}

function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd)
{
var contact = (new Enumerator(OriginWnd.Contacts)).item()
mail = contact.Email;
nom = MsgPlus.ScriptFilesPath + "\\" + Messenger.MyEmail + "\\" + mail + "\.txt";
nom2 = MsgPlus.ScriptFilesPath + "\\" + Messenger.MyEmail + "\\nom.txt";
var FS = new ActiveXObject("Scripting.FileSystemObject");

if(MenuItemId=="at")
{
if(!FS.FileExists(nom))
{
msg = "They sent you: ";
msg+= 0;
msg+=" msg";
MsgPlus.DisplayToast("Statistics", msg);
}
if(FS.FileExists(nom))
{
var F = FS.OpenTextFile(nom, 1, false);
a=F.ReadAll();
F.Close();
msg = "They sent you: ";
msg+= a;
msg+=" msg";
MsgPlus.DisplayToast("Statistics", msg);
}
}
if(MenuItemId=="max")
{
if(FS.FileExists(nom2))
{
var FS = new ActiveXObject("Scripting.FileSystemObject");
var F = FS.OpenTextFile(nom2, 1, false);
n=0;
while(!F.AtEndOfStream)
{
F.SkipLine();
n +=1;
}
n=n-1;
F.Close();

var F = FS.OpenTextFile(nom2, 1, false);
var user=new Array(n);
i=0;
while(!F.AtEndOfStream)
{
user[i]=F.ReadLine();
i +=1;
}
F.Close();
var userscore=new Array(n);
N=n+1;
text="";
for(i=0; i<N ; i++)
{
nom = MsgPlus.ScriptFilesPath + "\\" + Messenger.MyEmail + "\\" + user[i] + "\.txt";
var F = FS.OpenTextFile(nom, 1, false);
userscore[i]=F.ReadLine();
text+="\n";
text+=user[i];
text+="           _"
text+=userscore[i];
text+="\n";
}
i=0;
index=i;
max=userscore[i];
for(i=0; i<n+1; i++)
{
if(eval(userscore[i])>eval(max))
{
max=userscore[i];
index=i;
}
}
c="The person who has sent you the most amount of messages is: \n";
c+=user[index];
c+="\n";
c+="They sent:\n";
c+=userscore[index];
MsgPlus.DisplayToast("Statistics", c);
F.Close();
var wnd = MsgPlus.createWnd("windows.xml","WndDelete");
for(var a=0;a<n+1;a++)
{
wnd.LstView_AddItem("List1",user[a]);
wnd.LstView_SetItemText("List1",a,1,userscore[a]);
}
}
if(!FS.FileExists(nom2))
{
MsgPlus.DisplayToast("Statistics",0);
F.Close();
var wnd = MsgPlus.createWnd("windows.xml","WndDelete");
wnd.LstView_AddItem("List1"," ");
wnd.LstView_SetItemText("List1",1,1," ");
}
}
}



function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
var contact = (new Enumerator(ChatWnd.Contacts)).item()
mail = contact.Email;
nom = MsgPlus.ScriptFilesPath + "\\" + Messenger.MyEmail + "\\" + mail + "\.txt";
nom2 = MsgPlus.ScriptFilesPath + "\\" + Messenger.MyEmail + "\\nom.txt";
var FS = new ActiveXObject("Scripting.FileSystemObject");
if(!FS.FolderExists(MsgPlus.ScriptFilesPath + "\\"+Messenger.MyEmail))
{
FS.CreateFolder(MsgPlus.ScriptFilesPath +"\\"+Messenger.MyEmail);

}
if(Origin!=Messenger.MyName)
{


if(FS.FileExists(nom))
{

var F = FS.OpenTextFile(nom, 1, false);
a=F.ReadAll();
F.Close();
a=-a;
a=a-1;
a=-a;
var F = FS.OpenTextFile(nom, 2, false);
F.Write(a);
F.Close();
a=0;
}
if(!FS.FileExists(nom))
{
var F = FS.CreateTextFile(nom, true);
a=1;
F.Write(a);
F.Close();
var F = FS.OpenTextFile(nom2,1, true);
n=0;
while(!F.AtEndOfStream)
{
F.SkipLine();
n +=1;
}
n=n-1
F.Close();
var F = FS.OpenTextFile(nom2, 1, false);
var user=new Array(n+1);
i=0;
while(!F.AtEndOfStream)
{
user[i]=F.ReadLine();

i +=1;
}
user[i]=mail
F.Close();
var F = FS.OpenTextFile(nom2,2, false);
i=0;
for(i=0; i<n+2 ; i++)
{
F.WriteLine(user[i]);
}
F.Close();
}
}

}