Announcement

Collapse
No announcement yet.

checking my calendar for tomorrow only

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    checking my calendar for tomorrow only

    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

    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

    #2
    Can you use this call

    Code:
    hs.PluginFunction("BLGData", "", "GetCalendarEvents", new Object(){"me@here.com","My Calendar","04/02/2020"})
    Cheers,
    Bob
    Web site | Help Desk | Feature Requests | Message Board

    Comment


      #3
      If I do that it works. But I want to run that event every day and check tomorrows day, so the date
      "04/02/2020" needs to be replaced with a variable to hold tomorrows date

      Comment


        #4
        Install 3.0.52 in the beta section
        I added a new scripting call

        Code:
        hs.PluginFunction("BLGData", "", "GetCalendarEventsForTomorrow", new Object(){"xxx@gmail.com","Holidays"})
        Give it a try and let me know
        Cheers,
        Bob
        Web site | Help Desk | Feature Requests | Message Board

        Comment


          #5
          Perfect. Works a treat. Many thanks

          Comment


            #6
            No problem
            Cheers,
            Bob
            Web site | Help Desk | Feature Requests | Message Board

            Comment


              #7
              A little late to this, but I use the old plugin function like this and it works great.

              Dim tTomorrow as Datetime = Now.AddDays(1)
              Dim tWhen as String = tTomorrow.ToString("d")
              allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEvents", new Object(){myemail,tCalendar,tWhen})

              Comment

              Working...
              X