Ok well again I haven't had a chance to test it but I think the problem was mostly how I set it out (should have had the 'cont = 1' at the begining) I have also added another timer to just make sure there is no problems. I don't think there should be any more problems but I can't be assured of that, sorry.
code:
var cont;
function OnEvent_ChatWndCreated(ChatWnd)
{
cont = 1
var ChatWndContacts = ChatWnd.Contacts;
if(ChatWndContacts.Count == 1)
{
var e = new Enumerator(ChatWndContacts);
var Contact = e.item();
Debug.Trace('1')
MsgPlus.AddTimer('TimerId', '500')
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
Debug.Trace('2')
MsgPlus.AddTimer('TimerId2','100')
}
function OnEvent_Timer(TimerId)
{
if (TimerId == "TimerId")
{
Debug.Trace('/1')
if (cont == 1)
{
var Windows = Messenger.CurrentChats;
var e = new Enumerator(Windows);
for(; !e.atEnd(); e.moveNext())
{
var ChatWnd = e.item();
var ChatWndContacts = ChatWnd.Contacts;
if(ChatWndContacts.Count == 1)
{
var e = new Enumerator(ChatWndContacts);
var Contact = e.item();
MsgPlus.DisplayToastContact(Messenger.MyName ,"Opened a Chat Window With", Contact.Name,"CHIMES.WAV");
cont = ''
}
}
}
}
if (TimerId == "TimerId2")
{
if (cont == 1)
{
Debug.Trace('/2')
MsgPlus.CancelTimer('TimerId')
var Windows = Messenger.CurrentChats;
var e = new Enumerator(Windows);
for(; !e.atEnd(); e.moveNext())
{
var ChatWnd = e.item();
var ChatWndContacts = ChatWnd.Contacts;
if(ChatWndContacts.Count == 1)
{
var e = new Enumerator(ChatWndContacts);
var Contact = e.item();
MsgPlus.DisplayToastContact(Contact.Name ,"Opened a Chat Window With", Messenger.MyName ,"CHIMES.WAV");
cont = ''
}
}
}
}
}
EDIT:Sorry I finally got to test it and had to change a timer, hope you like it (should all work for you now)