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
40 / – / –
Joined: Aug 2005
O.P. RE: RE: my first script any help would be appriciated..
quote:
Originally posted by Matti
The reason why you're getting that error is because you're not checking how much e-mail addresses there are left in the array. You're simply incrementing the counter without checking whether it exceeds the length of the array.

By doing that, you end up with the email variable becoming undefined after a while. This won't throw an error immediately, so the script will continue and pass it as parameter to SetBinaryValue. However as soon as you try to access the length property of sKeyValue, an error will be thrown since there is no length property in undefined.

Looking at your code, it seems that you should have been able to find this out. You're tracing the value of sKeyValue at the start of SetBinaryValue so normally you should have found "sKeyValue = undefined" in your debugger.

Javascript code:
var emailList = [ 'test1@hotmail.com', 'test2@hotmail.com', 'test3@hotmail.com', 'test4@hotmail.com' ];
// ...
 
function OnEvent_Initialize(MessengerStart)
{
    // Check if there's anything to be done
    if(emailList.length > 0) {
        MsgPlus.AddTimer('windowDelayer', delayOpenWnd);
    }
}
 
// ...
 
function OnEvent_Timer(timerId)
{
    switch(timerId)
    {
        case 'windowDelayer':
            var email = emailList[counter];
            SetBinaryValue(HKEY_CURRENT_USER, WLMkey + '\\PerPassportSettings', 'DefaultMemberName', email);
            SetStringValue(HKEY_CURRENT_USER, MPLkey, 'DefaultUser', email);
            ExecuteWLM();
            Debug.Trace("Set default account = " + email);
 
            // Check if we should continue
            if(counter < emailList.length) {
                counter++;
                MsgPlus.AddTimer('windowDelayer', delayOpenWnd);
            }
        break;
    }
}

As you can see, despite of the debugger throwing an error inside SetBinaryValue, there was nothing wrong with that function. This is a good lesson for a developer - never rely solely on the error information! ;)

On another note, there seems to be a few more oddities in your script:
  • When the OnEvent_Initialize function is called on Messenger start-up, Messenger.MyStatus will still be 0 and thus your function will return immediately. This means that the emailList array will never be populated, causing your whole script to fail. I changed this in the code snippet above by populating the array as soon as its declared and by removing the status check at initialisation.
  • What happens when the other Messenger instances are opened? Is the script going to be executed for all those instances as well? Would that mean that all those script instances will keep opening new Messenger instances? Or am I wrong about this?



Hi Matti,

I forgot about that check with length! :$

I did found that the "sKeyValue = undefined" in the debugger. But I thought that was because I didn't pass 4 argument to that function. I only passed 3 to it.

Well the script executes all the messenger windows and signs in all the email addresses. Then it stops. It doesn't repeat this step for all instances of messenger.

Good point though, because my 3th try making such a script opened like 8 instances of messenger over and over.

I got another quick question. Is there any way to check which email addresses have been logged in?

This post was edited on 02-14-2010 at 12:32 PM by Yustme.
02-14-2010 11:29 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