Announcement

Collapse
No announcement yet.

Get events

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

  • Get events

    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

  • #2
    Originally posted by freeon View Post

    allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"lxxxxx", "Leon Bourque", 1})
    Try changing the 1 to 0 to get current days events : allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){"xxxxx", "Leon Bourque", 0})

    Comment


    • #3
      Thanks, that worked. I just realized I left my email address in the code. I just edited my op. Do you mind editing your and removing it. Not a big deal as it's an account that I only use for my office 365 events to be copied to so I can use this plugin.

      Comment


      • #4
        Also is there a way to list events in 12hour format instead of 24? So 3:00 PM instead of 15:00.

        Comment


        • #5
          I edited out the email address.

          try this in your script: DateTime.Parse(ev.StartTime).ToString("t")

          Comment


          • #6
            I'm a bit of a script newbie. Were am I supposed to put this in the script. Tried a few different thing that didn't work.

            Comment


            • #7
              Try replacing this line:
              Code:
              msg = msg & "<tr><td> " & ev.StartTime & " - " & ev.Name & "." & "</td></tr>"
              with this:
              Code:
              msg = msg & "<tr><td> " & DateTime.Parse(ev.StartTime).ToString("t") & " - " & ev.Name & "." & "</td></tr>"

              Comment


              • #8
                That worked. Thanks.

                Comment


                • #9
                  I want to show only calendar events that start in that hour so I can show it on hstouch, do you know how to do that, right now it shows all the events for that day.
                  Thanks

                  Sent from my SM-G935V using Tapatalk

                  Comment


                  • #10
                    Originally posted by aldo View Post
                    I want to show only calendar events that start in that hour so I can show it on hstouch, do you know how to do that, right now it shows all the events for that day.
                    The plugin can't do that. You would have to use scripting to accomplish what you want.

                    Comment


                    • #11
                      Unfortunately i asked Bob but no response from him, is anyone doing via script what I'm looking for, I'm very bad at script.

                      I'm also surprised that there is no suck function build into, I would assume it is an important feature to have.

                      Sent from my SM-G935V using Tapatalk

                      Comment

                      Working...
                      X