What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » my first script any help would be appriciated..

my first script any help would be appriciated..
Author: Message:
Yustme
Junior Member
**


Posts: 85
41 / – / –
Joined: Aug 2005
O.P. RE: my first script any help would be appriciated..
Hi Matti,

I got it almost completely working with your guidance. I still got a minor problem.

Here is my code:

JScript code:
var emailList = new Array();
var counter = 0;
var delayOpenWnd = 2000;


var MPLkey = 'SOFTWARE\\Patchou\\Messenger Plus! Live';
var WLMkey;
var WLMexe;

if(Messenger.Version >= 8.5)
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = 'SOFTWARE\\Microsoft\\Windows Live\\Messenger';
}

else
{
    WLMkey = 'SOFTWARE\\Microsoft\\MSNMessenger';
    WLMexe = WLMkey;
}


function OnEvent_Initialize(MessengerStart)
{
    if ( Messenger.MyStatus < STATUS_INVISIBLE ) return;
   
    emailList.push('test1@hotmail.com');
    emailList.push('test2@hotmail.com');
    emailList.push('test3@hotmail.com');
    emailList.push('test4@hotmail.com');
   
    MsgPlus.AddTimer('windowDelayer', delayOpenWnd);
}

function OnEvent_Uninitialize(MessengerExit)
{
    MsgPlus.CancelTimer('windowDelayer');
}


function ExecuteWLM()
{
    new ActiveXObject("Shell.Application").ShellExecute("C:/Program Files (x86)/Windows Live/Messenger/" + "msnmsgr.exe", "", "", "open", 1);
}

function OnEvent_Timer(timerId)
{
    switch(timerId)
    {
        case 'windowDelayer':
            var email = emailList[counter];
            counter++;
            SetBinaryValue(HKEY_CURRENT_USER, WLMkey + '\\PerPassportSettings', 'DefaultMemberName', email);
            SetStringValue(HKEY_CURRENT_USER, MPLkey, 'DefaultUser', email);
            ExecuteWLM();
            Debug.Trace("Set default account = " + email);
            MsgPlus.AddTimer('windowDelayer', delayOpenWnd);
        break;
        default:
    }
}


function OnEvent_SigninReady(emailaddr)
{
     var emailstat = Messenger.MyEmail;
    if(Messenger.MyStatus != STATUS_UNKNOWN)
    {
        Debug.Trace("User signed in, email = " = emailaddr + '\n');
        Debug.Trace("emailstat = " + emailstat + '\n');
    }
}


I got another quick question. Is there anything in this code that I don't need? for example the OnEvent_SigninReady?

Not sure what it should do.


Also, the function SetBinaryValue takes 4 arguments, but i'm only passing it 3.

JScript code:
function SetBinaryValue(lKeyLocation, sKey, sKeyName, sKeyValue)
{
Debug.Trace("sKeyValue = " + sKeyValue);
    var hKey = Interop.Allocate(4);
    var lBufferSize = Interop.Allocate(4);
        lBufferSize.WriteDWORD(0, 2 * sKeyValue.length + 2);
    var lRetVal = Interop.Call('advapi32.dll', 'RegOpenKeyExW', lKeyLocation, sKey, 0, KEY_WRITE, hKey);
        if(lRetVal == ERROR_SUCCESS)
        {
            lRetVal = Interop.Call('advapi32.dll', 'RegSetValueExW', hKey.ReadDWORD(0), sKeyName, 0, REG_BINARY, sKeyValue, lBufferSize.ReadDWORD(0));
            if(lRetVal == ERROR_SUCCESS)
            {
                CloseKey(hKey);
                return true;
            }
            else
            {
            return false;
            }
        }
        else
        {
        return false;
        }
}

Any idea what sKeyValue should be?

It gives me an error in the debug window. It says:

Error: 'length' is null or not an object (code: -2146823281)
       File: _Registry.js. Line: 145.



This would be the affected line:

lBufferSize.WriteDWORD(0, 2 * sKeyValue.length + 2);


In function:

SetBinaryValue()

This post was edited on 02-14-2010 at 12:03 AM by Yustme.
02-14-2010 12:02 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
my first script any help would be appriciated.. - by Yustme on 02-13-2010 at 03:25 PM
RE: my first script any help would be appriciated.. - by roflmao456 on 02-13-2010 at 04:43 PM
RE: RE: my first script any help would be appriciated.. - by Yustme on 02-13-2010 at 04:58 PM
RE: my first script any help would be appriciated.. - by Matti on 02-13-2010 at 07:02 PM
RE: RE: my first script any help would be appriciated.. - by Yustme on 02-13-2010 at 07:18 PM
RE: my first script any help would be appriciated.. - by Yustme on 02-14-2010 at 12:02 AM
RE: my first script any help would be appriciated.. - by Matti on 02-14-2010 at 11:04 AM
RE: RE: my first script any help would be appriciated.. - by Yustme on 02-14-2010 at 11:29 AM
RE: my first script any help would be appriciated.. - by petsas on 07-02-2010 at 01:49 PM
RE: my first script any help would be appriciated.. - by whiz on 07-02-2010 at 02:07 PM
RE: my first script any help would be appriciated.. - by CookieRevised on 07-03-2010 at 11:11 AM
RE: my first script any help would be appriciated.. - by whiz on 07-03-2010 at 11:35 AM
RE: RE: my first script any help would be appriciated.. - by CookieRevised on 07-03-2010 at 11:56 AM
RE: my first script any help would be appriciated.. - by petsas on 07-05-2010 at 11:13 AM
RE: my first script any help would be appriciated.. - by matty on 07-05-2010 at 01:26 PM
RE: my first script any help would be appriciated.. - by petsas on 07-05-2010 at 01:42 PM
RE: my first script any help would be appriciated.. - by Matti on 07-05-2010 at 02:26 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