What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » help block system

help block system
Author: Message:
tyron
New Member
*


Posts: 5
Joined: Sep 2006
O.P. help block system
I'm trying to create a script that auto-blocks and specified user when I sign out and automatically unblocks it when I sign in...
I think it's useful if you have a person that you should only talk from one place (like work) and don't want to be bored at your home, for example..

The problem is that I'm having problems trying to auto-block when I sign out - the function OnEvent_Signout is executed AFTER the WLM is closed, so the function to block is not well executed...

That's what I made this far (as I'm brazilian, I might have forgotten to translate some variable... Although, I don't think it'd be a problem):

code:
var BlockedUser = "___@hotmail.com"; //here comes the target email
var meuEmail = "_______@hotmail.com"; //here comes mine email

function OnEvent_Initialize(MessengerStart)
{
Debug.Trace("Hello World!");
}

function OnEvent_Uninitialize(MessengerExit)
{
}


function OnEvent_MyStatusChange(NewStatus) {
    if(Messenger.MyEmail == meuEmail)
        {
            Contact = Messenger.MyContacts.GetContact(BlockedUser);
       
            if (NewStatus!=2) {
            Contact.Blocked = true;
            } else
            Contact.Blocked = false;
        }
}


function block(contato,status)
{
    if(status== "no")
    {
        contato.Blocked = false;
    } else {
        contato.Blocked = true;
    }
}

function OnEvent_SigninReady(Email)
{
    if(Messenger.MyEmail == meuEmail)
        {
            Contact = Messenger.MyContacts.GetContact(BlockedUser);
   
            block(Contact,"no");
        }

}


function OnEvent_Signout(Email)
{
    if(Messenger.MyEmail == meuEmail)
        {
            try
                {
                    Contact = Messenger.MyContacts.GetContact(BlockedUser);
                    block(Contact,"yes");
                }
            catch(err)
                {
                    Debug.Trace(" Error");
                }

        }
}



Thank you a lot
09-30-2006 02:28 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: help block system
Could you not just use OnEvent_Uninitialize for it? It's called when the script is ending though, not the program.
<Eljay> "Problems encountered: shit blew up" :zippy:
09-30-2006 02:48 PM
Profile PM Find Quote Report
tyron
New Member
*


Posts: 5
Joined: Sep 2006
O.P. RE: help block system
quote:
Originally posted by SpunkyLoveMuff
Could you not just use OnEvent_Uninitialize for it? It's called when the script is ending though, not the program.

Hi,
I tried it too... But it still don't execute the final function..
I don't know if you understood me clearly: the function to block the contact should be called when the program is closing, like right-clicking on the icon next to the clock and choosing "Exit"...

Thanks again
09-30-2006 03:18 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: help block system
OnEvent_Uninitialize always works for me... Have you checked the debug window for any errors? (I know that seems like a stupiod thing to say, but you'd be surprised)


<Eljay> "Problems encountered: shit blew up" :zippy:
09-30-2006 03:29 PM
Profile PM Find Quote Report
tyron
New Member
*


Posts: 5
Joined: Sep 2006
O.P. RE: help block system
I checked the debug yes and I can quickly see that there's an error, but as I'm making changes to the closing of the program, the window closes itself before I can see exactly what it's written.

In fact, I think I know which error is being displayed: probably it's WLM telling me that the contact could not be blocked, as the connection (and the contact list) has already been closed.

Do you have any ideia?
Thks
09-30-2006 03:59 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: help block system
I haven't, but I bet there are people that can sort out (easily) for you. I don't have too mcuh experience with running functions as the program is closing down, just setting a few variables in the registry.
<Eljay> "Problems encountered: shit blew up" :zippy:
09-30-2006 04:01 PM
Profile PM Find Quote Report
tyron
New Member
*


Posts: 5
Joined: Sep 2006
O.P. RE: help block system
Ok so.. I'll wait for any other help...
But thank you very much for this help..
09-30-2006 04:06 PM
Profile E-Mail PM Find Quote Report
tyron
New Member
*


Posts: 5
Joined: Sep 2006
O.P. RE: help block system
nobody knows???
10-03-2006 10:47 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: help block system
Please don't bump threads.

As far as I know, you can not do an action that requires you to be signed in when the user signs out. The events only tell you when it's too late.
10-03-2006 11:16 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