What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Sleeping

Sleeping
Author: Message:
Zero
Junior Member
**

Avatar

Posts: 29
– / Male / Flag
Joined: Aug 2008
O.P. Sleeping
Hi folks - i'm just wondering how i'd go about sleeping my script? Actually, it may not be necessary since what I'm trying to do is figure out an easy way to refer back to a specific chat window after a given time interval. I don't wanna throw the chtwnd object into a global since it could get over-written; I can't pass the handle as a user-data param to AddTimer; and I can't seem to get seem to get the Sleep method of the WScript object to work (not too surprising I guess). Any other ideas?

  Zero
09-05-2008 04:29 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Sleeping
Global Variable:
code:
var oChatWnds = {};

Object assignment:
code:
oChatWnds[oChatWnd.Handle] = oChatWnd

This will never be overwritten however on the closing of a chat window you will want to do the following:

code:
delete oChatWnds[oChatWnd.Handle];
09-05-2008 05:23 PM
Profile E-Mail PM Find Quote Report
Zero
Junior Member
**

Avatar

Posts: 29
– / Male / Flag
Joined: Aug 2008
O.P. RE: Sleeping
I don't see how that'd work tho since I don't have access to the chat window handle as a param in the timer event func... while i'm waiting for the timer to fire, it'll be possible for the handle in the global to be overwritten...
09-05-2008 10:37 PM
Profile E-Mail PM Web Find Quote Report
pollolibredegrasa
Full Member
***

Avatar
formerly fatfreechicken

Posts: 483
Reputation: 34
35 / Male / Flag
Joined: May 2005
RE: Sleeping
Why not make the TimerId the chat window handle in your AddTimer call?
code:
MsgPlus.AddTimer(oChatWnd.Handle,5000);
Then in your timer event you could just enumerate the opened chat windows to find the one which has a handle that matches the TimerID:
code:
function OnEvent_Timer(sTimerId){
    var e = new Enumerator(Messenger.CurrentChats);
    for(; !e.atEnd(); e.moveNext()){
        var ChatWindow = e.item();
        if (ChatWindow.Handle == sTimerId){
            //Do whatever here
        }
    }
}

Something like that should work...
;p

[Image: chickennana.gif] Vaccy is my thin twin! [Image: chickennana.gif]
09-05-2008 11:15 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Sleeping
quote:
Originally posted by pollolibredegrasa
code:
function OnEvent_Timer(sTimerId){
    var e = new Enumerator(Messenger.CurrentChats);
    for(; !e.atEnd(); e.moveNext()){
        var ChatWindow = e.item();
        if (ChatWindow.Handle == sTimerId){
            //Do whatever here
        }
    }
}


You don't even need to do that... if you do what I said and what you said about using the timer as a param you can simply do the following:
code:
function OnEvent_Timer(sTimerId) {
    Debug.Trace(oChatWnds[paraseInt(sTimerId)].Handle);
}
09-07-2008 05:29 AM
Profile E-Mail PM Find Quote Report
Zero
Junior Member
**

Avatar

Posts: 29
– / Male / Flag
Joined: Aug 2008
O.P. RE: Sleeping
Brilliant! Thanks, guys!
09-08-2008 03:38 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On