I'm using this script to get calendar events and list them in a virtual device. Works fine except it always gets events for today and tomorrow. This runs at 5 am and today for example it got all events for today and tomorrow. The last one was at 3 pm so it's not because it's within a 24 hour period. Any idea how to fix?
Code:
sub Main(ByVal Parms As Object) Dim ParmArray() as String ParmArray = Parms.tostring.split(",") Dim tDevice = ParmArray(0) Dim tCalendar = ParmArray(1) Dim tDays = cint(ParmArray(2)) Dim allEvents As Object() Dim myemail as string="xxxx@gmail.com" Dim msg as string = "" allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxxxx@gmail.com", "Leon Bourque", 1}) msg="<table>" For Each ev As Object In allEvents msg = msg & "<tr><td> " & ev.StartTime & " - " & ev.Name & "." & "</td></tr>" Next msg=msg & "</table>" If Not Msg.Contains("-") Then msg="No Events Scheduled" hs.SetDeviceString(tDevice, msg.Trim, true) End Sub
Comment