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

Email PM Script
Author: Message:
Chunk1993
Junior Member
**

Avatar

Posts: 78
31 / Male / Flag
Joined: Jul 2007
O.P. Tongue  Email PM Script
Is there  [ or is it possible ] a script that shows how many emails you have in your personal message??

08-30-2007 11:44 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Email PM Script
The registry function was written by Matty. The script just gets the number of emails from the registry key windows uses to display the number of emails on the welcome screen.

code:
var email = your@email.com;

function OnEvent_Timer(timer){
    Messenger.MyPersonalMessage = GetKeyValue(0x80000001,"Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail\\"+email,"MessageCount");
MsgPlus.AddTimer("myTimer",120000);
}

function OnEvent_Initialize(){
    MsgPlus.AddTimer("myTimer",1000);
}

var KEY_READ = 0x20019;
var KEY_WRITE = 0x20006;
var KEY_EXECUTE = 0x20019;
var KEY_ALL_ACCESS = 0xf003f;
var REG_OPTION_NON_VOLATILE = 0;
var ERROR_SUCCESS = 0;
var ERROR_NO_MORE_ITEMS = 259;
function Registry_GetKeyValue(lKeyLocation, sKey, sKeyName) {
    var hKey = Interop.Allocate(4);
    var buff_size = 255;
    var lBufferSize = Interop.Allocate(4);
    lBufferSize.WriteDWORD(0, 2 * buff_size);
    var lRetVal = Interop.Call('advapi32.dll', 'RegOpenKeyExW', lKeyLocation, sKey, 0, KEY_READ, hKey);
    if (lRetVal === ERROR_SUCCESS) {
        var lpType = Interop.Allocate(4);
        lRetVal = Interop.Call('advapi32.dll', 'RegQueryValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, 0, lBufferSize);
        if (lRetVal === ERROR_SUCCESS) {
            switch (lpType.ReadDWORD(0)) {
                case REG_EXPAND_SZ :
                case REG_MULTI_SZ :
                case REG_SZ :
                    var Buffer = Interop.Allocate(2 * (lBufferSize.ReadDWORD(0) + 2));
                    Interop.Call('advapi32.dll', 'RegQueryValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, Buffer, lBufferSize);
                    Buffer = Buffer.ReadString(0);
                    break;
                case REG_DWORD:
                    var Buffer = Interop.Allocate(Math.max(4, lBufferSize.ReadDWORD(0)));
                    Interop.Call('Advapi32', 'RegQueryValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, Buffer, lBufferSize);
                    Buffer = Buffer.ReadDWORD(0);
                    break;
                case REG_BINARY :
                    var Buffer = Interop.Allocate((lBufferSize.ReadDWORD(0)+1)*2);
                    Interop.Call('advapi32.dll', 'RegQueryValueExW', hKey.ReadDWORD(0), sKeyName, 0, lpType, Buffer, lBufferSize);
                    Buffer = Buffer.ReadString(0);
                    break;
                default: return false; //Cannot read registry key
            }
            Registry_CloseKey(hKey.ReadDWORD(0));
            return Buffer;
        } else { return false; }
    } else { return false; }
}
<Eljay> "Problems encountered: shit blew up" :zippy:
09-10-2007 12:15 PM
Profile PM 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