Hello,
I'm spanish and my english is very poor. Sorry.
I have modified the script. I add a delay of one second after changing my name by the one of my contact.
I have tested it with a conversation and a contact and works.
The code:
code:
var myWnd;
var myName;
var myMessage;
function OnEvent_Initialize(MessengerStart) {
wait = false;
}
function OnEvent_ChatWndSendMessage(Wnd,Msg) {
if(Msg.length > 8 && wait == false) {
if(Msg.substr(0,8) == "!imitate") {
var WndContacts = Wnd.Contacts;
if(WndContacts.Count == 1) {
var e = new Enumerator(WndContacts);
var Cnt = e.item();
var Tmpname = Messenger.MyName;
myName = Messenger.MyName;
myWnd = Wnd;
myMessage = Msg.substr(9,Msg.length-9);
Messenger.MyName = Cnt.Name; wait = true;
MsgPlus.AddTimer('myTimer', 1000);
}
return "";
}
}
}
function OnEvent_Timer(TimerId)
{
if(TimerId == 'myTimer')
{
myWnd.SendMessage(myMessage);
Messenger.MyName = myName;
wait = false;
}
}