code:
function sendmsg(kime,msj) {
for(var e = new Enumerator(Messenger.CurrentChats); !e.atEnd(); e.moveNext())
{
var curWnd = e.item();
for(var f = new Enumerator(curWnd.Contacts); !f.atEnd(); f.moveNext())
{
if(f.item().Email == kime)
{
varmi = 1;
ChatWnd = curWnd;
break;
}
else {
if(varmi == null) {
varmi = 0;
}
}
}
}
if(varmi == 1) {
ChatWnd.SendMessage(msj);
}
if(varmi == 0) {
kisi = Messenger.OpenChat(kime);
kisi.SendMessage(msj);
}
}
if (you have a chat window with your contact)
{ send message }
else
{ open chat window
send message }
-> sendmsg("smarterchild@hotmail.com","hi")