What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [RELEASE] MSN Popup Spy

[RELEASE] MSN Popup Spy
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [RELEASE] MSN Popup Spy
quote:
Originally posted by afelipE_scripts
and what I can do to fix it? ms spy++ returns those values

I must count the number of controls of the window to make sure that is
It is not because spy++ reports it that that is the class name that you can use it to uniquely identify a window.... A class is rarely something "unique"... and class #32770 is even one of the least 'unique' classes as almost every program has such windows since they are generic "dialog window".

eg: even Plus! has more #32770 windows then just toasts. The floating contact windows are also of class #32770 (and also have two or three controls) to only name just one. The event viewer, script debugger, etc are also all #32770 classes. In fact every generic window (even script windows) are of class #32770.

You need to perform additional tests, which certainly do not end by counting the controls as that is again nothing unique. Start by looking only to #32770 windows which are created from the same thread and/or process and importantly check its owner and parent window which should be of class "MessengerPlusLive_ToastPopupParent".

And checking upon that ToastParent class instead of trying to find #32770 class windows is the proper method since that will already give you (by getting its children) all toasts at once without having the extreme overhead of checking each #32770 class window in Windows (because as said, there are extremely many), counting controls or whatever other certainly not unique and slow method....

Because also note that Plus! toasts can have more then just two controls, there are at least two different kind of toasts. For Messenger toasts this is the same, there is more then one kind...

--------------------

Other remarks:

First of all, it is a very nice idea for a script, however:

The script is not polygamy proof...






code:
if (!MessengerStart)    {
    OnEvent_SigninReady(Messenger.MyEmail);
}
This will fail since scripts can be restarted before the user is logged in. Don't check upon MessengerStart, but check upon the user's status:
if (Messenger.MyStatus > 1) OnEvent_SigninReady(Messenger.MyEmail);






code:
function ReadRegistry(key){
     try     {
      var toReturn = new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\" + key);
     }
     catch( e)     {
      var toReturn = 0;
     }
     finally     {
        return(toReturn);
     }
}
===>
code:
function ReadRegistry(key){
        try {
                return Number(new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\" + key));
        } catch( e) {
                // Set here your default value
                return 200
        }
}
Same principle for writeregistry.
And change REG_SZ in the writeregistry function to REG_DWORD.






code:
while (PlusWnd.LstBox_GetCount('lista')>0)         {
        PlusWnd.LstBox_RemoveItem('lista',0);
}
===>
code:
for (var i = PlusWnd.LstBox_GetCount('lista'); i > 0; )
        PlusWnd.LstBox_RemoveItem('lista',--i);
shorter and faster.






code:
function OnEvent_SigninReady(Email){
    try     {
        var firstrun = new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\opacity");
    } catch( e) {
         WriteRegistry("opacity","200");
    }
}
Please do not write stuff to the registry when it is not needed. This is a extremely bad habit.

The only time you should write something to the registry is in this save(PlusWnd) function. Nowhere else.

To read a value from the registry you should need to take in account that it doesn't exist. But if it doesn't exist (try/catch statements) NEVER write to the registry!, instead set your script value to the default value. There is really no need to clog up the registry for that.

As it is now, the SigninReady() function does not need to contain anything at all, since you do not need to check in this function upon existing settings if you aren't going to set it to some global variable.






code:
function strGettext(lngHwnd) {
    var ilngLength = Interop.Call("user32","SendMessageA",lngHwnd,14,0,0);
    var strBuffer = "";
    for (var x=0; x<ilngLength; x++) {
        strBuffer+=" ";
    }
    Interop.Call("user32","SendMessageW",lngHwnd,13,ilngLength+1,strBuffer);
    return(strBuffer);
}
That wont work. Variables in JScript are not passed by reference (they can't recieve values like that). You need to define and use a Plus! DataBlock for that.
===>
code:
function strGettext(lngHwnd) {
        var ilngLength = Interop.Call("user32", "SendMessageW", lngHwnd, /*WM_GETTEXTLENGTH*/ 0x0E, 0, 0);
        var strBuffer = Interop.Allocate(ilngLength * 2 + 2);
        Interop.Call("user32", "SendMessageW", lngHwnd, /*WM_GETTEXT*/ 0x0D, ilngLength+1, strBuffer.DataPtr);
        return strBuffer.ReadString(0);
}






code:
function OnEvent_Initialize(MessengerStart){
    Plus_WndNotification = MsgPlus.CreateWnd("window.xml","WndNotification", 1);
}
You should not display the window when the script (re)starts. It is of no use since if the user isn't logged in yet, he also can't recieve notifications either. The window should be displayed if the user is signed in.
===>
code:
function OnEvent_Initialize(bMessengerStart){
        if (Messenger.MyStatus > 1) OnEvent_SignIn(Messenger.MyMail);
}
function OnEvent_SignIn(sEmail){
        Plus_WndNotification = MsgPlus.CreateWnd("window.xml","WndNotification", 1);
        // It is also here that you should make this polygamy aware
}






code:
var heure = (date.getHours() < 10) ? "0" + date.getHours() + sep : date.getHours() + sep;
===>
code:
var heure = (date.getHours() < 10 ? "0" : "") + date.getHours() + sep;






code:
if (Plus_WndNotification.LstBox_GetCount("lista")>0) {
        Plus_WndNotification.LstBox_SetCurSel("lista", Plus_WndNotification.LstBox_GetCount("lista")-1);
    }
That check is not needed since you will always have an element in your list






code:
function cancel(PlusWnd){
    PlusWnd.visible=false;
}
There is no need to always keep the config window open. This is a bad habit. Close it when the user is done with it and reopen it when requested.
===>
code:
function cancel(PlusWnd){
    PlusWnd.Close(0);
}
same for all equivalent lines for the config window.







code:
if (!Plus_WndConfiguration.visible) {
        Plus_WndConfiguration.visible=true;
}
else                               {
        Plus_WndConfiguration.visible=false;
}
===>
code:
Plus_WndConfiguration.visible = !Plus_WndConfiguration.visible;
But note that you should not use this as I said earlier. The config window should be closed properly. If you don't do that you will have bad behaviour (eg: when the congif window is open, select it again from the menu, you'll see it will be closed (aka hidden in this case) again). Properly close the window instead... In other words, the entire
code:
if (!Plus_WndConfiguration.visible) {
    Plus_WndConfiguration.visible=true;
} else {
    Plus_WndConfiguration.visible=false;
}
should be removed.






code:
function OnEvent_Timer(TimerId){ ... }
The main core of this script, contains a lot of bugs and doesn't work properly






I hope these remarks are of any help....

.-= A 'frrrrrrrituurrr' for Wacky =-.
02-20-2007 02:54 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[RELEASE] MSN Popup Spy - by felipEx on 12-09-2006 at 05:17 PM
RE: [RELEASE] MSN Popup Spy - by -dt- on 12-09-2006 at 05:21 PM
RE: [RELEASE] MSN Popup Spy - by Felu on 12-09-2006 at 06:03 PM
RE: [RELEASE] MSN Popup Spy - by Kenji on 12-09-2006 at 06:06 PM
RE: [RELEASE] MSN Popup Spy - by Squelettor on 02-08-2007 at 02:43 PM
RE: [RELEASE] MSN Popup Spy - by Felu on 02-08-2007 at 03:42 PM
RE: [RELEASE] MSN Popup Spy - by Oxy on 02-08-2007 at 05:11 PM
RE: [RELEASE] MSN Popup Spy - by Squelettor on 02-09-2007 at 11:16 AM
RE: [RELEASE] MSN Popup Spy - by Felu on 02-09-2007 at 11:37 AM
RE: [RELEASE] MSN Popup Spy - by Squelettor on 02-09-2007 at 12:25 PM
RE: [RELEASE] MSN Popup Spy - by Wally on 02-09-2007 at 01:20 PM
[RELEASE] MSN Popup Spy - by sufor on 02-09-2007 at 01:30 PM
RE: [RELEASE] MSN Popup Spy - by Wally on 02-09-2007 at 01:39 PM
RE: [RELEASE] MSN Popup Spy - by Felu on 02-09-2007 at 01:50 PM
RE: [RELEASE] MSN Popup Spy - by sufor on 02-09-2007 at 01:56 PM
RE: [RELEASE] MSN Popup Spy - by Felu on 02-09-2007 at 02:12 PM
RE: [RELEASE] MSN Popup Spy - by felipEx on 02-09-2007 at 08:46 PM
[RELEASE] MSN Popup Spy - by sufor on 02-09-2007 at 09:17 PM
RE: [RELEASE] MSN Popup Spy - by vaccination on 02-09-2007 at 09:41 PM
RE: [RELEASE] MSN Popup Spy - by Felu on 02-10-2007 at 06:12 AM
RE: [RELEASE] MSN Popup Spy - by Squelettor on 02-10-2007 at 04:51 PM
RE: [RELEASE] MSN Popup Spy - by felipEx on 02-12-2007 at 02:00 AM
RE: [RELEASE] MSN Popup Spy - by • MaNiC MoE • on 02-12-2007 at 12:17 PM
RE: [RELEASE] MSN Popup Spy - by sufor on 02-13-2007 at 10:24 AM
RE: RE: [RELEASE] MSN Popup Spy - by felipEx on 02-13-2007 at 09:25 PM
RE: [RELEASE] MSN Popup Spy - by Boo B on 02-13-2007 at 09:18 PM
RE: [RELEASE] MSN Popup Spy - by CookieRevised on 02-13-2007 at 09:41 PM
RE: [RELEASE] MSN Popup Spy - by felipEx on 02-15-2007 at 08:01 PM
RE: [RELEASE] MSN Popup Spy - by CookieRevised on 02-20-2007 at 02:54 AM


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