I was going to recommend something like this, but then I thought what if there are 2 windows opened at the same time?
![:)](images/smilies/msn_happy.gif)
Solution: You can set the TimerID to ChatWnd, that way, you get one timer for each conversation. Then you also have to separate the "e" variable using an array.
For instance:
code:
var Emoticons;
var e = new Array();
var wnds = new Array();
function send_emoticon(wnd)
{
if(wnd.EditChangeAllowed==true)
{
Emoticons = Messenger.CustomEmoticons;
e[""+ wnd.Handle] = new Enumerator(Emoticons);
wnds[""+ wnd.Handle] = wnd; // Stock the chat window
OnEvent_Timer(""+ wnd.Handle); // launch the timer's loop
}
}
function OnEvent_Timer(timer)
{
if(wnds[timer].EditChangeAllowed==true){
var smile="";
for(var i = 0; !e[timer].atEnd()&&i<5; e.moveNext(), i++)smile=" "+e[timer].item().Shortcut;
wnds[timer].SendMessage(smile); // Send the 5 smilies
Debug.Trace(smile);
if(!e.atEnd())MsgPlus.AddTimer("timer_name", 5000); // If not finished yet, recall the function in 5 seconds
}
}
I haven't tried this code, I will do tomorrow.
![:)](images/smilies/msn_happy.gif)