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)

[beta] Voicemail 1.0 (released 12/08/2011)
Author: Message:
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
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[beta] Voicemail 1.0 (released 12/08/2011) - by whiz on 04-21-2011 at 10:06 PM
RE: [preview] Voicemail 1.0 - by CookieRevised on 04-21-2011 at 10:56 PM
RE: [preview] Voicemail 1.0 - by whiz on 04-23-2011 at 12:26 PM
RE: [preview] Voicemail 1.0 - by CookieRevised on 04-23-2011 at 02:16 PM
RE: [preview] Voicemail 1.0 - by whiz on 04-23-2011 at 03:49 PM
RE: [preview] Voicemail 1.0 - by CookieRevised on 04-23-2011 at 09:23 PM
RE: [preview] Voicemail 1.0 - by whiz on 04-24-2011 at 11:39 AM
RE: [preview] Voicemail 1.0 - by CookieRevised on 04-24-2011 at 06:13 PM
RE: [preview] Voicemail 1.0 - by whiz on 04-25-2011 at 06:55 PM
RE: [preview] Voicemail 1.0 - by foaly on 04-25-2011 at 07:52 PM
RE: [preview] Voicemail 1.0 - by whiz on 04-28-2011 at 12:54 PM
RE: [preview] Voicemail 1.0 - by KoenLemmen on 04-29-2011 at 02:20 PM
RE: [preview] Voicemail 1.0 - by whiz on 04-30-2011 at 11:35 AM
RE: [preview] Voicemail 1.0 - by whiz on 05-05-2011 at 01:10 PM
RE: [preview] Voicemail 1.0 - by SmokingCookie on 05-08-2011 at 07:42 AM
RE: [preview] Voicemail 1.0 - by whiz on 05-08-2011 at 01:04 PM
RE: [preview] Voicemail 1.0 - by SmokingCookie on 05-08-2011 at 03:23 PM
RE: [preview] Voicemail 1.0 - by whiz on 05-08-2011 at 04:07 PM
RE: [preview] Voicemail 1.0 - by SmokingCookie on 05-08-2011 at 05:07 PM
RE: [preview] Voicemail 1.0 - by whiz on 06-02-2011 at 02:12 PM
[beta] Voicemail 1.0 (released 12/08/2011) - by whiz on 08-12-2011 at 06:22 PM


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