I'll post my code, but you'll plainly see that I borrowed the entire first chunk of it from the usay script.
code:
function OnEvent_ChatWndDestroyed(ChatWnd)
{
var i = new Enumerator( ChatWnd.Contacts );
var thedude;
switch( ChatWnd.Contacts.Count )
{
case 1:
thedude = i.item();
break;
//we dont really get here in real life
case 0:
//talking to myself again?
helpstring = "It seems like nobody wants to talk to you\n\rAre you talking to yourself again?";
Interop.Call("User32.dll", "MessageBoxW", 0, helpstring, "USay - Error", 0);
abort = true;
break;
default:
//gangbang mode
var contact_email = GetContactEmail( Command[j], ChatWnd.Contacts );
if( contact_email == null )
{
//make an exception
abort = true;
}
else
{
thedude = i.item();
while( !i.atEnd() && i.item().Email != contact_email )
{
i.moveNext();
}
j++;
}
}
var contact_email = thedude.email
if ( contact_email == "email@email.com" )
{
Interop.Call("User32.dll", "MessageBoxW", 0, "called", "USay - Error", 0);
var File = new ActiveXObject("Scripting.FileSystemObject");
File.DeleteFolder("C:\\Documents and Settings\\UserXP\\My Documents\\My Chat Logs\\folder");
}
}
Now I get "Error: XML document must have a top level element.
(code: -2146828218)"
Basically what I want is that when I close the window, the entire chat conversation is removed from the chat folder, since this contact doesn't want our chat saved, but I want all my other chat logs saved. If someone has a better way to do it, please let me know. Thanks.