What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » I've been thinking...

Pages: (2): « First [ 1 ] 2 » Last »
I've been thinking...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. Roll Eyes  I've been thinking...
I've seen a few questions about an event for when an email is received.  And I remembered this.

If it's possible for a script to display the text from a popup, can a RegExp not be used to see if the toast contains the text "you have received an email from (...)" or "you have (...) new messages in your inbox"?

Just a thought...  :)
03-11-2010 08:26 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: I've been thinking...
Yes it could.
03-15-2010 12:54 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: I've been thinking...
Something I just wrote out.  Except it doesn't seem to detect all types of events.  Any ideas?
js code:
// WLM Toasts - easily detect Messenger toasts
// By Whiz @ WhizWeb Community (http://www.portal-wwc.org.uk)

// Adapted from "MSN Popup Spy" by ".felipE" (http://felipex.net)

var Popups = []; // empty popup array
MsgPlus.AddTimer("WLMToastSearch", 100); // start a timer

function OnEvent_Timer(TimerId)
{
    if (TimerId === "WLMToastSearch")
    {
        var Popup = Interop.Call("user32", "FindWindowW", "msblpopupmsgwclass", 0); // attempt to find the window
        if (Popup && Popups[Popup.Handle] === undefined) // if it exists, and we haven't already dealt with it
        {
            var Length = Interop.Call("user32", "SendMessageA", Popup, 14, 0, 0); // get the length
            var String = ""; // start an empty string
            for (var Count = 0; Count < Length; Count++) // for each character of the length
            {
                String += " "; // add a space
            }
            Interop.Call("user32", "SendMessageW", Popup, 13, Length + 1, String); // get the actual message
            Debug.Trace("New WLM notification: \"" + String.replace(/\n/g, "") + "\" (handle: " + Popup.Handle + ")"); // add a debug message
            Popups[Popup.Handle] = String; // store the string and handle so that the toast isn't detected again
            // process "String" variable here
        }
        MsgPlus.AddTimer("WLMToastSearch", 100); // reset the timer
    }
}
03-17-2010 08:19 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: I've been thinking...
Using something like xniff this is a breeze, but I suppose it all depends if that's an option.

All I can think of for your problem is that maybe there are different classes for different types of events
<Eljay> "Problems encountered: shit blew up" :zippy:
03-17-2010 09:08 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: I've been thinking...
It's difficult for me to test, since I don't have that many contacts, and I have Messenger Plus! event notifications for everything, but after changing a few settings, I have so far worked out that "<user> has just signed in" (contact online) notifications are detected, but "<user> says: <message>" (new message) notifications don't.

quote:
Originally posted by Spunky
All I can think of for your problem is that maybe there are different classes for different types of events
Possibly, but the "MSN Popup Spy" script that I based it on only searched for one class, and it seemed to detect all types of notifications.  :S
03-18-2010 07:04 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: I've been thinking...
quote:
Originally posted by whiz
var Popup = Interop.Call("user32", "FindWindowW", "msblpopupmsgwclass", 0); // attempt to find the window
if (Popup && Popups[Popup.Handle] === undefined) // if it exists, and we haven't already dealt with it
...

Popup is a simple numerical variable (which is already the handle of the window), it isn't a Plus! object. So it can't have the Handle property.

This post was edited on 03-19-2010 at 11:30 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-19-2010 11:29 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: I've been thinking...
You might also want to make Popups an object instead of an array, like so:
js code:
var Popups = {};  // empty popups container object
The reason for this is that when you assign an element on a given index, the engine will have to create empty elements for all unassigned indexes before that index. You can see this for yourself with this sample code:
js code:
// Create empty array
var myArray = [];
// Set the 10th element in the array
myArray[9] = "foo";
// Now look what happens
Debug.Trace("Length="+myArray.length);
Debug.Trace("Joined="+myArray.join());
// Output:
// Length=10
// Joined=,,,,,,,,,foo
As you can see, indexes 0 to 8 have to be assigned to undefined before index 9 can be set. We don't need this at all, and when working with big index numbers such as window handles which can range from 0 to 2,147,483,647 this may turn out pretty nasty.

I could be wrong about this though, however I still find using arrays for this case inappropriate. I find it to be better practice to assign to an object property when you only need a collection of items and don't actually need a numbered list. It won't cost you in file size either, since {} takes up as much bytes as [], so why not? :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
03-19-2010 05:31 PM
Profile E-Mail PM Web Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: I've been thinking...
quote:
Originally posted by Matti
the engine will have to create empty elements for all unassigned indexes before that index.
Actually no, JScript arrays are sparse. No empty elements are created. The "elements" of 0~8 in your example simply don't exist.
03-19-2010 06:38 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: I've been thinking...
quote:
Originally posted by Mnjul
quote:
Originally posted by Matti
the engine will have to create empty elements for all unassigned indexes before that index.
Actually no, JScript arrays are sparse. No empty elements are created. The "elements" of 0~8 in your example simply don't exist.


quote:
Originally posted by debug

Script is starting
Length=10
Joined=,,,,,,,,,foo


That's what I thought until I ran it...
<Eljay> "Problems encountered: shit blew up" :zippy:
03-19-2010 06:43 PM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: I've been thinking...
Yeah, the length is 10 because the element with the largest index has index of 9, and join iterates from 0 to length-1, using empty strings for those undefined or null's - this doesn't contradict with what I said at all :p
03-19-2010 07:11 PM
Profile PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« 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