What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [beta] Voicemail 1.0 (released 12/08/2011)

Pages: (3): « First [ 1 ] 2 3 » Last »
[beta] Voicemail 1.0 (released 12/08/2011)
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. Roll Eyes  [beta] Voicemail 1.0 (released 12/08/2011)
Beta version has been released!  Click here to try it out, and let me know any issues you come across.  In particular, please try the nudge shake option, both with and without the broken switch on, and tell me which works and with what version of WLM you are using.



I've been working on a little answer machine-type script that can take messages, grab your attention and tell other contacts when you return.  You just turn Voicemail on, then it takes over conversations as needed.  You can make it contact-specific if you like, as well as letting it automatically turn itself on and off automatically (e.g. when set to away/idle, locking messenger and so on).

[Image: attachment.php?pid=1013242]

Suggestions welcome.  It's nearly ready to go, but I can still add stuff in if you have any other ideas.  :)

.png File Attachment: Voicemail.png (24.69 KB)
This file has been downloaded 588 time(s).

This post was edited on 08-13-2011 at 03:11 PM by whiz.
04-21-2011 10:06 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [preview] Voicemail 1.0
looks cool (y)

The only things I see which might be nice to have are:

Maybe change the radio buttons into checkboxes for the "On attention command" so that the user can choose to play only a sound but not display a toast nor alert dialog. Or that he can choose both a toast (which will dissapear by nature) and a dialog ( which is permanent by nature).

Also, a nice and original* addition to the "On attention command" to choose from would be a simulated nudge (move/shake the chat window quickly, while playing the nudge sound.... well, you get the idea).

Ability to choose among the statusses for "enable whilst status is ..." and "disable whilst status is ..." in the form of a checkbox list of all statusses (maybe even incl. 'on the phone', etc, since those are still very valid).

;)

* AFAIK no script has ever done that.

This post was edited on 04-21-2011 at 11:00 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-21-2011 10:56 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [preview] Voicemail 1.0
quote:
Originally posted by CookieRevised
Maybe change the radio buttons into checkboxes for the "On attention command" so that the user can choose to play only a sound but not display a toast nor alert dialog. Or that he can choose both a toast (which will dissapear by nature) and a dialog ( which is permanent by nature).
Will do.  :)

quote:
Originally posted by CookieRevised
Also, a nice and original* addition to the "On attention command" to choose from would be a simulated nudge (move/shake the chat window quickly, while playing the nudge sound.... well, you get the idea).
I could play the sound, but how would I shake the window?  I guess maybe moving it a couple of pixels and then setting a timer a few times would do it...  maybe make the taskbar button blink - is that possible with scripting?

quote:
Originally posted by CookieRevised
Ability to choose among the statusses for "enable whilst status is ..." and "disable whilst status is ..." in the form of a checkbox list of all statusses (maybe even incl. 'on the phone', etc, since those are still very valid).
I'll see what I can do...
04-23-2011 12:26 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [preview] Voicemail 1.0
quote:
Originally posted by whiz
I could play the sound, but how would I shake the window?  I guess maybe moving it a couple of pixels and then setting a timer a few times would do it...
Indeed.

You would need to use a timer in a loop for this. Each iteration of the loop you move the window a bit (one pixels is too small I think though), then wait a bit, and then go to the next iteration, etc. It is the exact same way as Messenger does it.

To realy simulate a nudge and see what it actually does to the window you could record a video of a chatwindow when a nudge is recieved and then play that back slowly (frame by frame) so you can see how much pixels the window moved each time and in what direction. I guess the actual nudge is like 10 to 20 moves actually (and probably random) each with an interval in the order of millisecs. The final move is back to the original position of course.

Ideal would be to call that specific routine inside Messenger itself, but that would require some reverse engeneering I guess.

quote:
Originally posted by whiz
maybe make the taskbar button blink - is that possible with scripting?
yup, very possible. See the Windows API FlashWindow and FlashWindowEx if I'm not mistaken. Though, note that the taskbar button will already flash if the chat window wasn't in focus though (done by Messenger itself upon recieving incomming message).

-------

EDIT: just did a quick'n dirty test for the random placement of the window. Works perfectly so far. But the big problem is that MsgPlus.AddTimer does not allow a time of less than 100ms... and for the simulation you would need something like 10ms... :/
So, another possebility would be to use Windows timers. But you can't do that assyncroniously. So that would mean you 'lock' up all execution of Messenger for as long as the nudge simulation runs (=approx. 1 sec I think).

This post was edited on 04-23-2011 at 03:05 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-23-2011 02:16 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [preview] Voicemail 1.0
quote:
Originally posted by CookieRevised
EDIT: just did a quick'n dirty test for the random placement of the window. Works perfectly so far. But the big problem is that MsgPlus.AddTimer does not allow a time of less than 100ms... and for the simulation you would need something like 10ms... :/
So, another possebility would be to use Windows timers. But you can't do that assyncroniously. So that would mean you 'lock' up all execution of Messenger for as long as the nudge simulation runs (=approx. 1 sec I think).
Something I've thought about before with timers - is it possible, for example, to set two timers, one at 100ms and the other at 150ms, and then loop both so that something can be done every 50ms?

And then for this, maybe 10 timers, from 100ms to 190ms, and then repeat all 10 timers 10 times (in order to make it last 1s)?  I'll try it in a moment and see if it works.

Edit: seems to...  :P

This post was edited on 04-23-2011 at 03:57 PM by whiz.
04-23-2011 03:49 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [preview] Voicemail 1.0
Yeah, multiple timers will work, didn't thought of that...
Bit 'messy', but it will work.
You don't need to repeat the timers though.
:P

EDIT:
Something I quickly cooked up:
jscript code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
    if (sMessage === '/shake') {
        ShakeWindow(pChatWnd.Handle);
        return '';
    }
}

// global variables
var arrShakeWindow = {}; // array, will hold original window positions

// global constants
var g_nSquare = 4;    // movement factor in pixels (-? to +? of original position)
var g_nCount = 40;    // amount of moves
var g_nDelay = 40;    // delay between moves in milliseconds

function ShakeWindow(hWnd) {
    var lpRect = Interop.Allocate(16);
    Interop.Call('User32.dll', 'GetWindowRect', hWnd, lpRect.DataPtr);
    var x = lpRect.ReadDWord(0);
    var y = lpRect.ReadDWord(4);
    arrShakeWindow[hWnd] = {x:x, y:y, w:lpRect.ReadDWord(8) - x, h:lpRect.ReadDWord(12) - y};
    for (var i = 0; i < g_nCount; i++) {
        MsgPlus.AddTimer('shakeit' + (i<10?'0':'')+i + hWnd, 100 + i*g_nDelay)
    }
    MsgPlus.AddTimer('shakedone' + hWnd, 100 + i*g_nDelay)
}

function OnEvent_Timer(sTimerId) {
    var hWnd = sTimerId.substr(9)*1;
    var x = arrShakeWindow[hWnd].x;
    var y = arrShakeWindow[hWnd].y;
    var w = arrShakeWindow[hWnd].w;
    var h = arrShakeWindow[hWnd].h;
    if (sTimerId.substring(0, 7) === 'shakeit') {
        // move window a random amount between +g_nSquare and -g_nSquare pixels
        x += Math.floor((2 * g_nSquare + 1) * Math.random() - g_nSquare);
        y += Math.floor((2 * g_nSquare + 1) * Math.random() - g_nSquare);
    } else {
        // last call, thus also remove array element
        delete arrShakeWindow[hWnd];
    }
    Interop.Call('User32.dll', 'MoveWindow', hWnd, x, y, w, h, true);
}
EDIT: that arrShakeWindow global array should/can be removed from the global scope by applying the different array elements in the timer's name. But I cba to change it for this proof-of-concept :p

The other global variables/constants are just there for convenience to easy experiment with different values (thought the current ones are very close to the real thing I think). In a final code I would simply replace them with the hard coded values.

This post was edited on 04-24-2011 at 06:32 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-23-2011 09:23 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [preview] Voicemail 1.0
Hmm...  a bit more complicated than my attempt.  :P  I just tried moving it in 3-pixel jumps every 25ms for 1 second (so it kind of goes round in circles)...
jscript code:
// on attention command, with shake enabled
if (Options.Attention.Shake)
{
    MsgPlus.AddTimer("AttentionShakeWindow:" + ChatWnd.Handle + ":A:1", 100);
    MsgPlus.AddTimer("AttentionShakeWindow:" + ChatWnd.Handle + ":B:1", 125);
    MsgPlus.AddTimer("AttentionShakeWindow:" + ChatWnd.Handle + ":C:1", 150);
    MsgPlus.AddTimer("AttentionShakeWindow:" + ChatWnd.Handle + ":D:1", 175);
}

// ---------------------------

// timer event
if (TimerId.substr(0, 20) === "AttentionShakeWindow")
{
    var Data = TimerId.substr(21, TimerId.length).split(":"); // [ChatWnd, Pos, Cycle]
    Data[0] = Number(Data[0]);
    Data[2] = Number(Data[2]);
    var Rect = Interop.Allocate(32);
    Interop.Call("user32", "GetWindowRect", Data[0], Rect);
    var Pos = [Rect.ReadDWORD(0), Rect.ReadDWORD(4), Rect.ReadDWORD(8), Rect.ReadDWORD(12)]; // [Left, Top, Width, Height]
    switch (Data[1])
    {
        case "A":
            Pos[0] += 3;
            break;
        case "B":
            Pos[1] += 3;
            break;
        case "C":
            Pos[0] -= 3;
            break;
        case "D":
            Pos[1] -= 3;
            break;
    }
    Interop.Call("user32", "SetWindowPos", Data[0], 0, Pos[0], Pos[1], Pos[2], Pos[3], 0);
    if (Data[2] < 10)
    {
        MsgPlus.AddTimer("AttentionShakeWindow:" + Data[0] + ":" + Data[1] + ":" + (Data[2] + 1), 100);
    }
}
Although that doesn't work, it just causes the window to kind of freeze (the rest of Messenger works fine, just the conversation gets stuck).

I'll give your code a go and see what happens...



Edit: seems a similar problem occurs (this might be due to the skin I'm using, not sure yet):

Before...
[Image: 1tD1Z.png]

After...
[Image: ZBveJ.png]

The window still works, but only in the bottom bit (where it 'moved' to).  So the "Add to contact list" link that's higher up doesn't do anything, but the lower one still works.



Edit (2): applying the code to a Plus! window seems to work without any problems!

And no, skins don't affect it...
[Image: attachment.php?pid=1013300]

.png File Attachment: Shake Break.png (154.81 KB)
This file has been downloaded 519 time(s).

This post was edited on 04-24-2011 at 11:54 AM by whiz.
04-24-2011 11:39 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [preview] Voicemail 1.0
Hmmm... my code works without any glitches here though (incl. with skins).

I don't know why it wont work with you. There is no reason why it wouldn't work since it is essentially just a MoveWindow/SetWindowPos call. It might indicate something else is wrong on your system maybe?

Haven't tested your code yet, but personally and at first sight I think I would replace the SetWindowPos API with the MoveWindow API because SetWindowPos (at least like you used it) also activates the window and there might also be other Windows messages it might not send which MoveWindow does (iirc SetWindowsPos is just a subset of what MoveWindow actually does). But this is just a personal pref though.

But what I realy would do is to remove the GetWindowRec API from the timer event function in your code, and move it to the 'start shaking' function. Because getting the size each time is kind of useless in the timer event since it never changes (the same for the position; it doesn't change if you don't rely on the 'moved' position, but instead rely on the original position of the window). And each call to an API takes time too, so...

But all this said, I don't think it would fix the issue you're having though. :/

This post was edited on 04-24-2011 at 06:42 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-24-2011 06:13 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [preview] Voicemail 1.0
Found something else out: the amount by which it moves depends on where the window is in relation to the top-left corner of the screen.

Example: when the conversation is in the top-left corner, the inner bit only moves a little.  When the window is moved to the centre of the screen, it moves a lot more.

...so by using x and y as 0, it seems to work (but only shakes the inner window, i.e. not the title bar/border, just the content).

Do you think this might be version-dependant?  I'm using WLM 2011 and Plus! 5 on Windows 7 64-bit.

This post was edited on 04-25-2011 at 06:58 PM by whiz.
04-25-2011 06:55 PM
Profile E-Mail PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
RE: [preview] Voicemail 1.0
quote:
Originally posted by whiz
Found something else out: the amount by which it moves depends on where the window is in relation to the top-left corner of the screen.

Example: when the conversation is in the top-left corner, the inner bit only moves a little.  When the window is moved to the centre of the screen, it moves a lot more.

...so by using x and y as 0, it seems to work (but only shakes the inner window, i.e. not the title bar/border, just the content).

Do you think this might be version-dependant?  I'm using WLM 2011 and Plus! 5 on Windows 7 64-bit.
your code gave the same effect on my machine:
WLM 2011 and Plus! 5 on Windows 7 32-bit
haven't tried cookies code

edit:
cookies also gives the same strange behavior...

This post was edited on 04-28-2011 at 01:16 PM by foaly.
[signature.jpg]
04-25-2011 07:52 PM
Profile E-Mail PM Find Quote Report
Pages: (3): « First [ 1 ] 2 3 » 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