I'm working on a script and need to put names into a list view box. I want an option to only display online contacts. So I created this code:
quote:
function populateContacts(who){
Debug.Trace(who);
for(i = pollWindow.LstView_GetCount('List1');i>=0;i--){
pollWindow.LstView_RemoveItem("List1",i);
}
i=0;
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext()) {
var Contact = e.item();
if(who==="all"){
pollWindow.LstView_AddItem("List1",Contact.Email,i);
pollWindow.LstView_SetItemText("List1",i,1,Contact.Name);
i++;
}else if(who==="online"&&Contact.Status>2){
pollWindow.LstView_AddItem("List1",Contact.Email,i);
pollWindow.LstView_SetItemText("List1",i,1,Contact.Name);
if(pollWindow.LstView_GetItemText("List1",i,1)==="1")Debug.Trace("error: "+i+": "+Contact.Name);
i++;
}
}
pollWindow.SetControlText("lbl_num","0 / "+i+" Contacts Selected");
}
My problem is that certain contacts ALWAYS have the name shown as "1" and I don't understand why. I though it might be a script problem, but I've seen signout message saying "1 has signed out".
It always happens when i = one of these numbers:
0
2
3
4
8
10
11
12
Can someone please tell me if it's a script error or something dodgy with my Messenger Plus! please?
PS: Would have indented, but still looks wierd and just as hard to read