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