What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Block MSN Contact on a Schedule Basis

Block MSN Contact on a Schedule Basis
Author: Message:
~*McoreD*~
Junior Member
**


Posts: 95
40 / Male / Flag
Joined: Nov 2002
O.P. Block MSN Contact on a Schedule Basis
Hi Guys,

I was wondering how I could use MsgPlus to block a certain contact or (contacts) on a scheduled basis.

Say I wanna block AnnoyingGuy123 everyday from 0900 to 1300 and 1400 to 2100. How could I do such thing? Is it possible?

Thanks in advance,
McoreD


This post was edited on 08-23-2007 at 10:21 AM by ~*McoreD*~.
Don’t say CD’s to say more than one CD. It is CDs.
A 200 GB hard disk has capacity for 186 GiB of data
International standard date notation is YYYY-MM-DD
08-23-2007 10:21 AM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Block MSN Contact on a Schedule Basis
Use a script...

[code]
var email = "AnnoyingGuy123@hotmail.com"; //Their Email
var start_hour = 9; //Time to block contact
var start_minutes = 0; //Time to block contact
var stop_hour = 13; //Time to unblock contact
var stop_minutes= 0; //Time to unblock contact

function OnEvent_Timer(tID){
var d = new Date();
var hour = d.getHour();
var minutes = d.getMinutes();
if(hour>=start_hour&&minutes>=start_minutes&&hour<=stop_hour&&minutes<=stop_minutes){
var Contact = Contacts.GetContact(email);
Contact.Blocked = true
}else{
var Contact = Contacts.GetContact(email);
Contact.Blocked = false;
}
}

function OnEvent_SigninReady(){
MsgPlus.AddTimer("block",10000);
}

That should work... I'm actually gonna develop this later with support for multiple users/times
<Eljay> "Problems encountered: shit blew up" :zippy:
08-23-2007 02:19 PM
Profile PM Find Quote Report
~*McoreD*~
Junior Member
**


Posts: 95
40 / Male / Flag
Joined: Nov 2002
O.P. RE: Block MSN Contact on a Schedule Basis
Hi Spunky, that's a great way to do it.

Got a small prob.

Function called: OnEvent_SigninReady
Error: Object doesn't support this property or method (code: -2146827850)
       File: ScheduleBlock.js. Line: 10.
Function OnEvent_Timer returned an error. Code: -2147352567

Line 10 turns out to be

    var hour = d.getHour();

Fingers crossed.

Thanks,
McoreD

P.S: This got me an idea that we can actually change our status on the same schedule basis too! I guess that is not implemented anywhere either. Hopefully you can add that feature too? :D

This post was edited on 08-23-2007 at 11:47 PM by ~*McoreD*~.
Don’t say CD’s to say more than one CD. It is CDs.
A 200 GB hard disk has capacity for 186 GiB of data
International standard date notation is YYYY-MM-DD
08-23-2007 11:45 PM
Profile E-Mail PM Web Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Block MSN Contact on a Schedule Basis
Change line 10 to:
code:
var hour = d.getHours();

Just a typo. :)
4 8 15 16 23 42
08-23-2007 11:57 PM
Profile E-Mail PM Find Quote Report
~*McoreD*~
Junior Member
**


Posts: 95
40 / Male / Flag
Joined: Nov 2002
O.P. RE: Block MSN Contact on a Schedule Basis
Thanks!

Now this is really weird yeah?

Script is now loaded and ready
Function called: OnEvent_SigninReady
Error: 'Contacts' is undefined (code: -2146823279)
       File: ScheduleBlock.js. Line: 17.
Function OnEvent_Timer returned an error. Code: -2147352567

Line 17 is

        var Contact = Contacts.GetContact(email);

but it didn't complain line 13 which is also

        var Contact = Contacts.GetContact(email);

in the code:


if(hour>=start_hour&&minutes>=start_minutes&&hour<=stop_hour&&minutes<=stop_minutes){
        var Contact = Contacts.GetContact(email);
        Debug.Trace(email + " is blocked");
        Contact.Blocked = true
    } else {
        var Contact = Contacts.GetContact(email);
        Debug.Trace(email + " is unblocked");
        Contact.Blocked = false;
    }

Don’t say CD’s to say more than one CD. It is CDs.
A 200 GB hard disk has capacity for 186 GiB of data
International standard date notation is YYYY-MM-DD
08-24-2007 12:02 AM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Block MSN Contact on a Schedule Basis
Noticed some problems... I'm back from work now so I can actually test as I go through this time ;)



Re-structured code below. start_hour, start_minute, stop_hour and stop_minute represent a 24 hour clock (ie. 1 = 1AM, 13 = 1PM)

I forgot to define a couple of things and forgot the OnEvent_Initialize function... Works fine for me atm, just gonna make interface and add support for multiple schedules.

code:
var email = "nospam@hotmail.co.uk"; //Their Email
var start_hour = 1; //Time to block contact
var start_minutes = 57; //Time to block contact
var stop_hour = 1; //Time to unblock contact
var stop_minutes= 58; //Time to unblock contact

function OnEvent_Timer(tID){
    var d = new Date();
    var hour = d.getHours(); //fixed typo ;)
    var minutes = d.getMinutes();
    var Contacts = Messenger.MyContacts; //Forgot to define it :p
    if(hour>=start_hour&&minutes>=start_minutes){
            var Contact = Contacts.GetContact(email);
            if(hour<=stop_hour&&minutes<stop_minutes){
                Contact.Blocked = true
                Debug.Trace("Blocked: "+email);
            }else{
                Contact.Blocked = false;
                Debug.Trace("Un-Blocked: "+email);
            }       
    }
    MsgPlus.AddTimer(tID, 10000);
}

function OnEvent_SigninReady(){
    MsgPlus.AddTimer("block",1000);
}

function OnEvent_Initialize(){
    if(Messenger.MyStatus > 1){
        OnEvent_SigninReady();
    }
}




Been working on the interface and so on. I've made the script multi-user (using UserIDs to distinguish between users) and all emails stored in the registry are converted to their userIDs.

[Image: attachment.php?pid=844525]

.png File Attachment: preview.png (11.95 KB)
This file has been downloaded 783 time(s).

This post was edited on 08-24-2007 at 03:54 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
08-24-2007 01:03 AM
Profile PM Find Quote Report
~*McoreD*~
Junior Member
**


Posts: 95
40 / Male / Flag
Joined: Nov 2002
O.P. RE: Block MSN Contact on a Schedule Basis
Sweet Jesus, that's great work Spunky! :O :D
Don’t say CD’s to say more than one CD. It is CDs.
A 200 GB hard disk has capacity for 186 GiB of data
International standard date notation is YYYY-MM-DD
08-24-2007 10:06 AM
Profile E-Mail PM Web Find Quote Report
aNILEator
Skinning Contest Winner
*****

Avatar
...in the wake of the aNILEator

Posts: 3718
Reputation: 90
35 / Male / Flag
Joined: Oct 2003
Status: Away
RE: Block MSN Contact on a Schedule Basis
nice one spunky :)

my friend always talks to me when she's at work and she's annoying then so this'd be handy
08-24-2007 12:06 PM
Profile PM Web Find Quote Report
~*McoreD*~
Junior Member
**


Posts: 95
40 / Male / Flag
Joined: Nov 2002
O.P. RE: Block MSN Contact on a Schedule Basis
Hi Punky, Just wondering if you haven't forgotten this. No pressure if you haven't. :D
Don’t say CD’s to say more than one CD. It is CDs.
A 200 GB hard disk has capacity for 186 GiB of data
International standard date notation is YYYY-MM-DD
09-05-2007 11:01 AM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Block MSN Contact on a Schedule Basis
quote:
Originally posted by ~*McoreD*~
Hi Punky, Just wondering if you haven't forgotten this. No pressure if you haven't. :D

Should have a working version posted soon... it works atm, but I don't want to release an unfinished script. Just adding options and finishing touches atm
<Eljay> "Problems encountered: shit blew up" :zippy:
09-05-2007 11:20 AM
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