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
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.