Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Macros, Scripts, and Formulas Repository
 PowerHome Messageboard : PowerHome Macros, Scripts, and Formulas Repository
Subject Topic: delayed illumination (daylight saving) Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: February 04 2007 at 07:22 | IP Logged Quote krommetje

I made this short macro to account for daylight savings!
The macro checks which month it currently is, when it is winter (here in europe) the Lights go on Immediatly, when it is sommertime, a new Timed Event is created 90 minutes in the future...

[code]
insert into macroheader values ('TEST-MONTH','TEST-MONTH',0,0,1);
insert into macrodetail values ('TEST-MONTH',1,38,'',0,'Case(month(today())when 1 then ph_macro("<YOUR MACRO>")when 2 then ph_macro("<YOUR MACRO>") when 3 then ph_macro("<YOUR MACRO>") when 10 then ph_macro("<YOUR MACRO>") when 11 then ph_macro("<YOUR MACRO>") when 12 then ph_macro("<YOUR MACRO>") else ph_usermessage("Checking the need for Delayed Illumination"))',0,'');
insert into macrodetail values ('TEST-MONTH',2,38,'',0,'Case(month(today())when 4 then ph_createtimedevent(0,"<YOUR MACRO>",ph_relativedatetime(today(),90))when 5 then ph_createtimedevent(0,"<YOUR MACRO>",ph_relativedatetime(today(),90)) when 6 then ph_createtimedevent(0,"<YOUR MACRO>",ph_relativedatetime(today(),90)) when 7 then ph_createtimedevent(0,"<YOUR MACRO>",ph_relativedatetime(today(),90)) when 8 then ph_createtimedevent(0,"<YOUR MACRO>",ph_relativedatetime(today(),90)) when 9 then ph_createtimedevent(0,"<YOUR MACRO>",ph_relativedatetime(today(),90)) else ph_usermessage("Wintertime: no delayed illimination"))
',0,'');
insert into macrodetail values ('TEST-MONTH',3,39,'',NULL,'',0,'');
[\code]


be sure to adapt the macro by replacing "<YOUR MACRO>" with your own macro(s)
Peter

Edited by krommetje - February 04 2007 at 07:26
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: February 05 2007 at 00:22 | IP Logged Quote krommetje

Addeddum:

as TonyNo stated elsewhere: here is a way to reduce the code a bit:

Code:

Case( month( today())when 4 to 9 then ph_createtimedevent( 0,"<YOUR MACRO>", ph_relativedatetime( today(),90)) else ph_macro( "<YOUR MACRO>"))



Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum