quote:
Originally posted by Eagle_Erwin
I'm trying to make a script that closes the conversation-window when a contact signs out.
The code I have now:
code:
function OnEvent_ContactSignout(Email){
var contact=Messenger.MyContacts.GetContact(Email);
var chats = Messenger.CurrentChats;
var e = new Enumerator(contacts);
for(; !e.atEnd(); e.moveNext()){
var chat = e.item();
var contact1=chat.Contacts
if(contact==contact1){
chat.Close();
}
}
}
But, this doesn't work. What is wrong in this script, or what script can I use to close the conversation window of the person that signs out?
Hi,
this should work :
code:
function OnEvent_ContactSignout(sEmail)
{
CloseWindows();
}
function OnEvent_ChatWndContactRemoved(ChatWnd, sEmail)
{
CloseWindows();
}
function CloseWindows()
{
var chats = Messenger.CurrentChats;
var e = new Enumerator(chats);
for(; !e.atEnd(); e.moveNext())
{
var chat = e.item();
var e2 = new Enumerator(chat.Contacts);
var bCanClose = true;
for (; !e2.atEnd(); e2.moveNext())
{
var contact = e2.item();
bCanClose &= (contact.Status != 1);
}
if (bCanClose)
Interop.Call("user32","SendMessageW", chat.Handle, 16, 0, 0);
}
}
It works when :
You are in a conversation with 1 contact and he signs out
You are in a conversation with 5 contacts, 2 signs out and 3 leaves the conversation.