quote:
Originally posted by Mattike
quote:
Originally posted by TheGuruSupremacy
Try to use this code
Note that this will only work to look for received messages sent by someone else. You can't use it to modify the way your own messages are displayed on your side, because ChatWnd.Contacts only include the contacts in a chat window except the active Messenger user. Therefore, you can't use that to compare it to your name.
I don't think it....It's true that ChatWnd.Contacts only include the contacts in a chat window except the active Messenger user but you can compare with your name using syntax if....else...
Function Example:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind )
{var Contacts = ChatWnd.Contacts
var Contact = new Array()
var e = new Enumerator(Contacts)
var AmI = new Boolean()
var i =0
Debug.Trace("Chatting with ")
for(;!e.atEnd();e.moveNext()){
Contact[i] = e.item().Name
Debug.Trace(Contact[i])
i++}
for(var y=0;y<Contact.length;y++){
if (Origin==Contact[y]){
AmI=false}else{
AmI=true
break}
}
Debug.Trace("Message: " + Message)
Debug.Trace("Have i written this message???" + AmI)
}
However i have checked that it can not work with timestamp because not only your name is modificated but also contact's name...you can use this code
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind )
{var time = new Date()
var hours = time.getHours()
var minutes = time.getMinutes()
var seconds = time.getSeconds()
var Myformattednick = "[" + hours + "." + minutes + "." + seconds + "]" + " " + Messenger.MyName
Debug.Trace(Myformattednick)
Debug.Trace(Origin)
if (Myformattednick!=Origin){
//do anything
}else{//do else
}
}