I have a holiday calendar, and I run this just after midnight to see if the day is a holiday to do various things. Works fine. But now I am trying to check if the next day is a holiday. That does not seem to work.
When I change
allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxx@gmail.com","Holidays",0})
to
allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxx@gmail.com","Holidays",1})
and today is a holiday, and tomorrow isnt, it still shows 'holiday found in calendar' in the log
I have also tried to calculate tomorrows date and putting a variable instead of 0 or 1, but that throws errors
When I change
allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxx@gmail.com","Holidays",0})
to
allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxx@gmail.com","Holidays",1})
and today is a holiday, and tomorrow isnt, it still shows 'holiday found in calendar' in the log
I have also tried to calculate tomorrows date and putting a variable instead of 0 or 1, but that throws errors
Code:
Sub Main(parm as object) Const ScriptName As String = "SendCalEvents" Dim allEvents As Object() Dim Datetomorrow as Date Datetomorrow = Today Datetomorrow = DateAdd ("d", 1, Today) allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxx@gmail.com","Holidays",Datetomorrow}) If allEvents.GetUpperBound(0) = -1 hs.writelog("Info", "No Holiday found in calendar") 'hs.SetDeviceValueByRef(2035,0,true) Else hs.writelog("Info", "Holiday found in calendar") 'hs.SetDeviceValueByRef(2035,100,true) End If
Comment