Shoutbox

Function on event friday? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Function on event friday? (/showthread.php?tid=84458)

Function on event friday? by DennisMartijn on 06-22-2008 at 09:05 AM

I'd like to have a script with a On_Event function, which will function when its friday.

Basicly, I would like the proper code for a code like this:
On_Event Day = Friday ;
(my own coding here)

Can someone help me with this? It would be greatly appreciated!


RE: Function on event friday? by zogo on 06-22-2008 at 09:53 AM

the only way i think you could do it is to seperate the script up

1. to work out the day
using the "if" commands etc...

2. the function itself

however i dunno the exact code

sorry


RE: Function on event friday? by Matti on 06-22-2008 at 10:18 AM

Well, you could do a check on the day of the week when the script starts up, this will work fine if you don't leave your PC and Messenger on during the night.

code:
function OnEvent_Initialize(MessengerStart) {
   if(Messenger.MyStatus > 0) OnEvent_SigninReady(Messenger.MyEmail);
}

function OnEvent_SigninReady(Email) {
   if(new Date().getDay() == 5) { //Sunday = 0, Monday = 1,...
      //It's Friday! Do something here!
   }
}
However, when you want to do the same when you go from Thursday 23:59:59 to Friday 00:00:00, you'll have to use a timer to do that. If you really really need that, I could help you with it. The code above will work perfectly if you shut down your Messenger every day. :)