Announcement

Collapse
No announcement yet.

Event listing in a HS Device?

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

    #91
    Originally posted by Pierre View Post
    This is a nice script.
    When formating the string, I would suggest using "<br>" instead of "<tr><td>", or using both, in order to show this device string in HStouch with some formating left.

    I also have made my way to format all-day events, recurring events, birthdays and events for the next days, witch was sometimes tricky.

    Hello.
    Mind sharing how you do this in the script?

    At least how to get today events in bold, and future events normal text.

    Thank you

    Comment


      #92
      There was an update of mono today. Chek if the issue is still there

      Comment


        #93
        Originally posted by jyrki69 View Post
        sparkman just helped me with the script not running under Linux.

        The fix was to change "Dim allEvents As Object()" to "Dim allEvents As Object".

        This script code now works perfect under Linux:

        Code:
        Sub Main(ByVal Parms As Object)
        Dim ParmArray() as String
        ParmArray = Parms.tostring.split(",")
        Dim tDevice as string = ParmArray(0)
        Dim tCalendar as string = ParmArray(1)
        Dim tDays as integer = cint(ParmArray(2))
        Dim allEvents As Object
        Dim myemail as string="youremail@gmail.com"
        Dim msg as string = ""
        
        allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){myemail,tCalendar, tDays})
        msg="<table>"
        For Each ev As Object In allEvents
        msg = msg & "<tr><td> " & ev.StartTime & " - " & ev.Name & "." & "</td></tr>"
        Next
        msg=msg & "</table>"
        if msg="" then msg="No Events Scheduled"
        hs.SetDeviceString(tDevice, msg.Trim, true)
        End Sub
        How much memory does this plugin comsume on your linux machine?

        Comment


          #94
          jyrki69
          Here is a copy of the script I use, and that I did not change since the message your are referring to.
          Your must change the settings under "user's settings"

          PHP Code:
          This is script to copy all calendar's appointments for today and tomerrow
          '
          The string can then be used easyly in HSTouch, or by speaking

          'You must have BLGData plugin installed and running, with at least one agenda in the setup into a device's string.
          'You must also create or use a device where to store, use it's adress iin the settings below



          Sub Main
          (ByVal Parm As Object)

          dim chaine as string=""
          dim User_email,Calendar_name,prefix_heure as string
          dim NumberofDays 
          as integer
          dim TodayGCal_device 
          as integer
          dim jour 
          as string DateTime.Now.Date.Tostring("dd/MM/yyyy")
          dim heure as string Now.Tostring("HH:mm")
          dim today_txt,today_txt_allday,tomorrow_txt,tomorrow_txt_allday,bckgrd_color,event_name as string

          'user's settings=========================================================================

          TodayGCal_device=760 'the adress of the device where the events are going to be dumped in the string
          User_email= "yourname@gmail.com" '
          user email as in the BLGData plugin
          Calendar_name
          ="xxxxxxxxxxxxx@gmail.com" 'Calendar name as in the BLGData plugin
          NumberofDays=1 '
          number of days to fetch ahead
          bckgrd_color
          ="#A0EAE7"
          today_txt=" A "
          today_txt_allday=""
          tomorrow_txt="DEMAIN A "
          tomorrow_txt_allday="DEMAIN "

          'end of user'
          s settings=========================================================================


          Dim allEvents As Object()
              
          allEvents hs.PluginFunction("BLGData""""GetCalendarEventsForXDays", new Object(){User_email,Calendar_name,NumberofDays})
              Try

                
          'Log("GoogleCalendar Script 1 Starting")
           chaine="<table bgcolor='" & bckgrd_color   & "'>"
              For Each ev As Object In allEvents
                 ' 
          hs.writelog("Info"" A: "  ev.StartTime " Pierre: " ev.Name)

                      
          ' on écarte aussi les événements dont l'heure de fin est passée
                      
          if ev.StartDate=jour and ev.EndTimeheure then


                                          
          'detecte les évènements journee entière pour aujourd'hui
                                          
          if ev.StartTime="00:00" and ev.Endtime="00:00" then
                                                      chaine
          chaine "<tr><td>" today_txt_allday chaine "  " ev.Name ".</td></tr>"
                                          
          else
                                              
          chainechaine "<tr><td>" today_txt ev.StartTime ": " ev.Name ". </td></tr>"
                                          
          end if                                      

                     elseif 
          ev.StartDate>jour then
                                      
          'detecte les évènements journee entière
                                       if ev.StartTime="00:00" and ev.Endtime="00:00" then
                                                      chaine= chaine & "<tr><td>" & tomorrow_txt_allday & ev.Name & ". </td></tr>"
                                          else
                                          chaine= chaine & "<tr><td>" & tomorrow_txt  & ev.StartTime & " : " & ev.Name & ". </td></tr>"
                                          end if
                     end if
                      '
          chaine=chaine "</tr>"
              '  Log("--- End Of Entry ---")
              Next
               '
          Log("End Of GoogleCalendar Script")
          chaine=chaine "</table>"
          ' Log("End Of GoogleCalendar Script 1")
               Log(chaine)    

          '
          if string is empty the device value will be set to 0    
          if striptags(chaine)="" then
                  hs
          .SetDeviceValueByref(TodayGCal_device,0,true)
                   
          hs.setdeviceString(TodayGCal_device,"",true)

            else 
          'if there is a string set the device value to 100
                  hs.SetDeviceValueByref(TodayGCal_device,100,true)
                  hs.setdeviceString(TodayGCal_device,chaine,true)

           end if



              Catch ex As Exception
                  Log("Exception: " & ex.Message.ToString)
              End Try
          End Sub

          Sub Log(ByVal ParStr As String)
              hs.writelog("Ald_gcal_tostring", ParStr)
          End Sub


          Function striptags(Byval chaine as string)'
          enleve les tags
          dim debut
          fin as integer
          'enleve les tags
                  '
          hs.writelog "signature_mail",chaine
              
          do

                
          'cherche les <
                  debut = Instr (chaine,"<")
               if debut <>0 then '
          boucle a garder autrement erreur
                  
          'hs.writelog "message",debut


                '
          cherche les >
                  
          fin Instr (chaine,">")
                  
          'msgbox fin

                '
          enleve ce qui est entre les 2 bornes

                 chaine 
          left(chaine,debut-1) & right(chaine,len(chaine)-fin)  
                  
          'hs.writelog "signature_mail",chaine
                end if
              loop while debut<>0


              '
          msgbox data
              
          return chaine
          end 
          Function 
          Visit zee e-maison : http://www.e-maison.com

          Comment


            #95
            Originally posted by Pierre View Post
            jyrki69
            Here is a copy of the script I use, and that I did not change since the message your are referring to.
            Your must change the settings under "user's settings"

            PHP Code:
            This is script to copy all calendar's appointments for today and tomerrow
            '
            The string can then be used easyly in HSTouch, or by speaking

            'You must have BLGData plugin installed and running, with at least one agenda in the setup into a device's string.
            'You must also create or use a device where to store, use it's adress iin the settings below



            Sub Main
            (ByVal Parm As Object)

            dim chaine as string=""
            dim User_email,Calendar_name,prefix_heure as string
            dim NumberofDays 
            as integer
            dim TodayGCal_device 
            as integer
            dim jour 
            as string DateTime.Now.Date.Tostring("dd/MM/yyyy")
            dim heure as string Now.Tostring("HH:mm")
            dim today_txt,today_txt_allday,tomorrow_txt,tomorrow_txt_allday,bckgrd_color,event_name as string

            'user's settings=========================================================================

            TodayGCal_device=760 'the adress of the device where the events are going to be dumped in the string
            User_email= "yourname@gmail.com" '
            user email as in the BLGData plugin
            Calendar_name
            ="xxxxxxxxxxxxx@gmail.com" 'Calendar name as in the BLGData plugin
            NumberofDays=1 '
            number of days to fetch ahead
            bckgrd_color
            ="#A0EAE7"
            today_txt=" A "
            today_txt_allday=""
            tomorrow_txt="DEMAIN A "
            tomorrow_txt_allday="DEMAIN "

            'end of user'
            s settings=========================================================================


            Dim allEvents As Object()
            allEvents hs.PluginFunction("BLGData""""GetCalendarEventsForXDays", new Object(){User_email,Calendar_name,NumberofDays})
            Try

            'Log("GoogleCalendar Script 1 Starting")
            chaine="<table bgcolor='" & bckgrd_color & "'>"
            For Each ev As Object In allEvents
            hs.writelog("Info"" A: " ev.StartTime " Pierre: " ev.Name)

            ' on écarte aussi les événements dont l'heure de fin est passée
            if ev.StartDate=jour and ev.EndTimeheure then


            'detecte les évènements journee entière pour aujourd'hui
            if ev.StartTime="00:00" and ev.Endtime="00:00" then
            chaine
            chaine "<tr><td>" today_txt_allday chaine " " ev.Name ".</td></tr>"
            else
            chainechaine "<tr><td>" today_txt ev.StartTime ": " ev.Name ". </td></tr>"
            end if

            elseif 
            ev.StartDate>jour then
            'detecte les évènements journee entière
            if ev.StartTime="00:00" and ev.Endtime="00:00" then
            chaine= chaine & "<tr><td>" & tomorrow_txt_allday & ev.Name & ". </td></tr>"
            else
            chaine= chaine & "<tr><td>" & tomorrow_txt & ev.StartTime & " : " & ev.Name & ". </td></tr>"
            end if
            end if
            '
            chaine=chaine "</tr>"
            ' Log("--- End Of Entry ---")
            Next
            '
            Log("End Of GoogleCalendar Script")
            chaine=chaine "</table>"
            ' Log("End Of GoogleCalendar Script 1")
            Log(chaine)

            '
            if string is empty the device value will be set to 0
            if striptags(chaine)="" then
            hs
            .SetDeviceValueByref(TodayGCal_device,0,true)
            hs.setdeviceString(TodayGCal_device,"",true)

            else 
            'if there is a string set the device value to 100
            hs.SetDeviceValueByref(TodayGCal_device,100,true)
            hs.setdeviceString(TodayGCal_device,chaine,true)

            end if



            Catch ex As Exception
            Log("Exception: " & ex.Message.ToString)
            End Try
            End Sub

            Sub Log(ByVal ParStr As String)
            hs.writelog("Ald_gcal_tostring", ParStr)
            End Sub


            Function striptags(Byval chaine as string)'
            enleve les tags
            dim debut
            fin as integer
            'enleve les tags
            '
            hs.writelog "signature_mail",chaine
            do

            'cherche les <
            debut = Instr (chaine,"<")
            if debut <>0 then '
            boucle a garder autrement erreur
            'hs.writelog "message",debut


            '
            cherche les >
            fin Instr (chaine,">")
            'msgbox fin

            '
            enleve ce qui est entre les 2 bornes

            chaine 
            left(chaine,debut-1) & right(chaine,len(chaine)-fin)
            'hs.writelog "signature_mail",chaine
            end if
            loop while debut<>0


            '
            msgbox data
            return chaine
            end 
            Function 
            Do you run this under Linux or Windows?

            Comment


              #96
              Windows
              Visit zee e-maison : http://www.e-maison.com

              Comment


                #97
                Originally posted by Pierre View Post
                jyrki69
                Here is a copy of the script I use, and that I did not change since the message your are referring to.
                Your must change the settings under "user's settings"

                PHP Code:
                This is script to copy all calendar's appointments for today and tomerrow
                '
                The string can then be used easyly in HSTouch, or by speaking

                'You must have BLGData plugin installed and running, with at least one agenda in the setup into a device's string.
                'You must also create or use a device where to store, use it's adress iin the settings below



                Sub Main
                (ByVal Parm As Object)

                dim chaine as string=""
                dim User_email,Calendar_name,prefix_heure as string
                dim NumberofDays 
                as integer
                dim TodayGCal_device 
                as integer
                dim jour 
                as string DateTime.Now.Date.Tostring("dd/MM/yyyy")
                dim heure as string Now.Tostring("HH:mm")
                dim today_txt,today_txt_allday,tomorrow_txt,tomorrow_txt_allday,bckgrd_color,event_name as string

                'user's settings=========================================================================

                TodayGCal_device=760 'the adress of the device where the events are going to be dumped in the string
                User_email= "yourname@gmail.com" '
                user email as in the BLGData plugin
                Calendar_name
                ="xxxxxxxxxxxxx@gmail.com" 'Calendar name as in the BLGData plugin
                NumberofDays=1 '
                number of days to fetch ahead
                bckgrd_color
                ="#A0EAE7"
                today_txt=" A "
                today_txt_allday=""
                tomorrow_txt="DEMAIN A "
                tomorrow_txt_allday="DEMAIN "

                'end of user'
                s settings=========================================================================


                Dim allEvents As Object()
                allEvents hs.PluginFunction("BLGData""""GetCalendarEventsForXDays", new Object(){User_email,Calendar_name,NumberofDays})
                Try

                'Log("GoogleCalendar Script 1 Starting")
                chaine="<table bgcolor='" & bckgrd_color & "'>"
                For Each ev As Object In allEvents
                hs.writelog("Info"" A: " ev.StartTime " Pierre: " ev.Name)

                ' on écarte aussi les événements dont l'heure de fin est passée
                if ev.StartDate=jour and ev.EndTimeheure then


                'detecte les évènements journee entière pour aujourd'hui
                if ev.StartTime="00:00" and ev.Endtime="00:00" then
                chaine
                chaine "<tr><td>" today_txt_allday chaine " " ev.Name ".</td></tr>"
                else
                chainechaine "<tr><td>" today_txt ev.StartTime ": " ev.Name ". </td></tr>"
                end if

                elseif 
                ev.StartDate>jour then
                'detecte les évènements journee entière
                if ev.StartTime="00:00" and ev.Endtime="00:00" then
                chaine= chaine & "<tr><td>" & tomorrow_txt_allday & ev.Name & ". </td></tr>"
                else
                chaine= chaine & "<tr><td>" & tomorrow_txt & ev.StartTime & " : " & ev.Name & ". </td></tr>"
                end if
                end if
                '
                chaine=chaine "</tr>"
                ' Log("--- End Of Entry ---")
                Next
                '
                Log("End Of GoogleCalendar Script")
                chaine=chaine "</table>"
                ' Log("End Of GoogleCalendar Script 1")
                Log(chaine)

                '
                if string is empty the device value will be set to 0
                if striptags(chaine)="" then
                hs
                .SetDeviceValueByref(TodayGCal_device,0,true)
                hs.setdeviceString(TodayGCal_device,"",true)

                else 
                'if there is a string set the device value to 100
                hs.SetDeviceValueByref(TodayGCal_device,100,true)
                hs.setdeviceString(TodayGCal_device,chaine,true)

                end if



                Catch ex As Exception
                Log("Exception: " & ex.Message.ToString)
                End Try
                End Sub

                Sub Log(ByVal ParStr As String)
                hs.writelog("Ald_gcal_tostring", ParStr)
                End Sub


                Function striptags(Byval chaine as string)'
                enleve les tags
                dim debut
                fin as integer
                'enleve les tags
                '
                hs.writelog "signature_mail",chaine
                do

                'cherche les <
                debut = Instr (chaine,"<")
                if debut <>0 then '
                boucle a garder autrement erreur
                'hs.writelog "message",debut


                '
                cherche les >
                fin Instr (chaine,">")
                'msgbox fin

                '
                enleve ce qui est entre les 2 bornes

                chaine 
                left(chaine,debut-1) & right(chaine,len(chaine)-fin)
                'hs.writelog "signature_mail",chaine
                end if
                loop while debut<>0


                '
                msgbox data
                return chaine
                end 
                Function 
                Thank you so much!

                Comment


                  #98
                  Originally posted by MattL0 View Post

                  How much memory does this plugin comsume on your linux machine?
                  I need to check the status as of now when I get home. I have ran some lookups on the memory usage because of the issues stated in the other thread, and in my setup it did not consume a whole lot of memory like mentioned there.

                  Comment


                    #99
                    Quick question to our script experts, I've been using the GCalendar script for a while and was thinking it would be nice to have a Virtual Device with tomorrows calendar events but the parameter tDays (0,1,2,3..) outputs; Day 1, Day1+Day2, Day1+Day2+Day3 but it would be nice to have a single day output what do I have to do to make it so? thanxs in advance Mike

                    Parmeters: 402,My Calendar,1
                    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="Myemail@XXX.com"
                            Dim msg as string = ""
                    
                            allEvents = hs.PluginFunction("BLGData", "", "GetCalendarEventsForXDays", new Object(){myemail,tCalendar,tDays})
                        For Each ev As Object In allEvents
                            msg = msg & ev.StartTime & " - " & ev.Name & ". " & "</br>"
                        Next
                            if msg="" then msg="No Events Scheduled"
                            hs.SetDeviceString(tDevice, msg.Trim, true)
                    End Sub
                    Computer: CUK Intel NUC7i7BNH
                    Op System: Windows10 Pro - Work Station
                    HS Version: HS4 Pro Edition 4.2.19.0

                    Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                    Comment


                      Originally posted by Pierre View Post
                      jyrki69
                      Here is a copy of the script I use, and that I did not change since the message your are referring to.
                      Your must change the settings under "user's settings"

                      PHP Code:
                      This is script to copy all calendar's appointments for today and tomerrow
                      '
                      The string can then be used easyly in HSTouch, or by speaking

                      'You must have BLGData plugin installed and running, with at least one agenda in the setup into a device's string.
                      'You must also create or use a device where to store, use it's adress iin the settings below



                      Sub Main
                      (ByVal Parm As Object)

                      dim chaine as string=""
                      dim User_email,Calendar_name,prefix_heure as string
                      dim NumberofDays 
                      as integer
                      dim TodayGCal_device 
                      as integer
                      dim jour 
                      as string DateTime.Now.Date.Tostring("dd/MM/yyyy")
                      dim heure as string Now.Tostring("HH:mm")
                      dim today_txt,today_txt_allday,tomorrow_txt,tomorrow_txt_allday,bckgrd_color,event_name as string

                      'user's settings=========================================================================

                      TodayGCal_device=760 'the adress of the device where the events are going to be dumped in the string
                      User_email= "yourname@gmail.com" '
                      user email as in the BLGData plugin
                      Calendar_name
                      ="xxxxxxxxxxxxx@gmail.com" 'Calendar name as in the BLGData plugin
                      NumberofDays=1 '
                      number of days to fetch ahead
                      bckgrd_color
                      ="#A0EAE7"
                      today_txt=" A "
                      today_txt_allday=""
                      tomorrow_txt="DEMAIN A "
                      tomorrow_txt_allday="DEMAIN "

                      'end of user'
                      s settings=========================================================================


                      Dim allEvents As Object()
                      allEvents hs.PluginFunction("BLGData""""GetCalendarEventsForXDays", new Object(){User_email,Calendar_name,NumberofDays})
                      Try

                      'Log("GoogleCalendar Script 1 Starting")
                      chaine="<table bgcolor='" & bckgrd_color & "'>"
                      For Each ev As Object In allEvents
                      hs.writelog("Info"" A: " ev.StartTime " Pierre: " ev.Name)

                      ' on écarte aussi les événements dont l'heure de fin est passée
                      if ev.StartDate=jour and ev.EndTimeheure then


                      'detecte les évènements journee entière pour aujourd'hui
                      if ev.StartTime="00:00" and ev.Endtime="00:00" then
                      chaine
                      chaine "<tr><td>" today_txt_allday chaine " " ev.Name ".</td></tr>"
                      else
                      chainechaine "<tr><td>" today_txt ev.StartTime ": " ev.Name ". </td></tr>"
                      end if

                      elseif 
                      ev.StartDate>jour then
                      'detecte les évènements journee entière
                      if ev.StartTime="00:00" and ev.Endtime="00:00" then
                      chaine= chaine & "<tr><td>" & tomorrow_txt_allday & ev.Name & ". </td></tr>"
                      else
                      chaine= chaine & "<tr><td>" & tomorrow_txt & ev.StartTime & " : " & ev.Name & ". </td></tr>"
                      end if
                      end if
                      '
                      chaine=chaine "</tr>"
                      ' Log("--- End Of Entry ---")
                      Next
                      '
                      Log("End Of GoogleCalendar Script")
                      chaine=chaine "</table>"
                      ' Log("End Of GoogleCalendar Script 1")
                      Log(chaine)

                      '
                      if string is empty the device value will be set to 0
                      if striptags(chaine)="" then
                      hs
                      .SetDeviceValueByref(TodayGCal_device,0,true)
                      hs.setdeviceString(TodayGCal_device,"",true)

                      else 
                      'if there is a string set the device value to 100
                      hs.SetDeviceValueByref(TodayGCal_device,100,true)
                      hs.setdeviceString(TodayGCal_device,chaine,true)

                      end if



                      Catch ex As Exception
                      Log("Exception: " & ex.Message.ToString)
                      End Try
                      End Sub

                      Sub Log(ByVal ParStr As String)
                      hs.writelog("Ald_gcal_tostring", ParStr)
                      End Sub


                      Function striptags(Byval chaine as string)'
                      enleve les tags
                      dim debut
                      fin as integer
                      'enleve les tags
                      '
                      hs.writelog "signature_mail",chaine
                      do

                      'cherche les <
                      debut = Instr (chaine,"<")
                      if debut <>0 then '
                      boucle a garder autrement erreur
                      'hs.writelog "message",debut


                      '
                      cherche les >
                      fin Instr (chaine,">")
                      'msgbox fin

                      '
                      enleve ce qui est entre les 2 bornes

                      chaine 
                      left(chaine,debut-1) & right(chaine,len(chaine)-fin)
                      'hs.writelog "signature_mail",chaine
                      end if
                      loop while debut<>0


                      '
                      msgbox data
                      return chaine
                      end 
                      Function 
                      Pierre, thanxs for sharing your script, quick translation question "Chaine" does that stand for Chain or is there some other meaning/term like (msg)? Mike

                      UPDATE: Pierre, per chance do you have the formatted or indented version of your script? Mike
                      Computer: CUK Intel NUC7i7BNH
                      Op System: Windows10 Pro - Work Station
                      HS Version: HS4 Pro Edition 4.2.19.0

                      Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                      Comment


                        MNB
                        Mike, "Chaine" stands for "chain" of characters but it is just a variable and you can change its name for whatever you want.
                        I have formated the code in a better way, I hope it helps.

                        I am using 3 differents version of this script, one for each of my calendars, that only differs by the background color, and the other user's settings.

                        PHP Code:
                        'This is script to copy all calendar's appointments for today and tomerrow
                        'The string can then be used easyly in HSTouch, or by speaking

                        '
                        You must have BLGData plugin installed and runningwith at least one agenda in the setup into a device's string.
                        '
                        You must also create or use a device where to store, use it's adress iin the settings below



                        Sub Main(ByVal Parm As Object)

                        dim chaine as string=""
                        dim User_email,Calendar_name,prefix_heure as string
                        dim NumberofDays as integer
                        dim TodayGCal_device as integer
                        dim jour as string = DateTime.Now.Date.Tostring("dd/MM/yyyy")
                        dim heure as string = Now.Tostring("HH:mm")
                        dim today_txt,today_txt_allday,tomorrow_txt,tomorrow_txt_allday,bckgrd_color,event_name as string

                        '
                        user's settings=========================================================================

                        TodayGCal_device=760 '
                        the adress of the device where the events are going to be dumped in the string
                        User_email
                        "yourname@gmail.com" 'user email as in the BLGData plugin
                        Calendar_name="xxxxxxxxxxxxx@gmail.com" '
                        Calendar name as in the BLGData plugin
                        NumberofDays
                        ='number of days to fetch ahead
                        bckgrd_color="#A0EAE7" '
                        background color
                        today_txt
                        =" Today"
                        today_txt_allday="All day "
                        tomorrow_txt="Tomorow at "
                        tomorrow_txt_allday="Tomorow "

                        'end of user'
                        s settings=========================================================================


                        Dim allEvents As Object()
                        allEvents hs.PluginFunction("BLGData""""GetCalendarEventsForXDays", new Object(){User_email,Calendar_name,NumberofDays})
                        Try

                        'Log("GoogleCalendar Script 1 Starting")
                        chaine="<table bgcolor='" & bckgrd_color & "'>"

                        For Each ev As Object In allEvents
                        hs.writelog("Info"" A: " ev.StartTime " Pierre: " ev.Name)

                        ' we get rid of events that are already done    +-----  on écarte aussi les événements dont l'heure de fin est passée
                        if ev.StartDate=jour and ev.EndTimeheure then


                            
                        'lets detect "all day events"  --**--  detecte les évènements journee entière pour aujourd'hui
                            
                        if ev.StartTime="00:00" and ev.Endtime="00:00" then
                                chaine
                        chaine "<tr><td>" today_txt_allday chaine " " ev.Name ".</td></tr>"
                                
                        else
                                
                        chainechaine "<tr><td>" today_txt ev.StartTime ": " ev.Name ". </td></tr>"
                            
                        end if

                            elseif 
                        ev.StartDate>jour then
                                
                        'detects "all day" events =----=  detecte les évènements journee entière
                                    if ev.StartTime="00:00" and ev.Endtime="00:00" then
                                    chaine= chaine & "<tr><td>" & tomorrow_txt_allday & ev.Name & ". </td></tr>"
                                    else
                                    chaine= chaine & "<tr><td>" & tomorrow_txt & ev.StartTime & " : " & ev.Name & ". </td></tr>"
                                end if
                            end if
                            '
                        chaine=chaine "</tr>"
                            ' Log("--- End Of Entry ---")
                            Next
                            '
                        Log("End Of GoogleCalendar Script")
                            
                        chaine=chaine "</table>"
                            ' Log("End Of GoogleCalendar Script 1")
                            Log(chaine)

                            '
                        if string is empty the device value will be set to 0
                            
                        if striptags(chaine)="" then
                                hs
                        .SetDeviceValueByref(TodayGCal_device,0,true)
                                
                        hs.setdeviceString(TodayGCal_device,"",true)

                                else 
                        'if there is a string set the device value to 100
                                hs.SetDeviceValueByref(TodayGCal_device,100,true)
                                hs.setdeviceString(TodayGCal_device,chaine,true)
                        end if



                        Catch ex As Exception
                        Log("Exception: " & ex.Message.ToString)
                        End Try
                        End Sub

                        Sub Log(ByVal ParStr As String)
                        hs.writelog("Ald_gcal_tostring", ParStr)
                        End Sub

                        '
                        *****************************************************************************
                        Function 
                        striptags(Byval chaine as string)'gets rid of html tags *---*   enleve les tags
                        dim debut, fin as integer
                        '
                        gets rid of html tags +---+  enleve les tags  
                        'hs.writelog "signature_mail",chaine
                        do
                            '
                        search for <    *--*  cherche les <
                            
                        debut Instr (chaine,"<")
                            if 
                        debut <>0 then 'boucle a garder autrement erreur
                                '
                        hs.writelog "message",debut

                                
                        'search for >   *----* cherche les >
                                fin = Instr (chaine,">")
                                '
                        msgbox fin

                                
                        ' delete what is between *----*enleve ce qui est entre les 2 bornes

                                chaine = left(chaine,debut-1) & right(chaine,len(chaine)-fin)
                                '
                        hs.writelog "signature_mail",chaine
                            end 
                        if
                        loop while debut<>0

                        'msgbox data
                        return chaine
                        end Function  
                        '
                        ******************************************************************************** 
                        Visit zee e-maison : http://www.e-maison.com

                        Comment


                          Pierre, many thanxs for the comeback, I will try your updated script "as is" before anglicizing it to verify that it works. When I took the previous version I got an error message within my HS Log as follows;
                          .
                          Mar-06 6:03:54 PM Error Initializing script engine: Length cannot be less than zero. Parameter name: length
                          Mar-06 6:03:54 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/HS3 GCalendar Events Script (Single Day).vb("Main")
                          Mar-06 6:03:54 PM Event Event Trigger "Calendar Data BLData Calendar Events (Single Day)"
                          Mar-06 6:03:54 PM Event Event Calendar Data BLData Calendar Events (Single Day) triggered by the event page 'Run'
                          .
                          Update:
                          Was still getting the message above even with the latest update, so I tried one of my shorter known working script and had the same results.. I deleted the event and created a new one and "wala" it's now working (stray cosmic rays?)

                          Pierre thanxs for the script, love the color within my calendar virtual device! But I'm noticing that I have today and tomorrows calendar events with "Tomorrow" for both today and tomorrow calendar events, what am I missing? Is it possible to have just tomorrow's calendar events? Mike
                          Attached Files
                          Computer: CUK Intel NUC7i7BNH
                          Op System: Windows10 Pro - Work Station
                          HS Version: HS4 Pro Edition 4.2.19.0

                          Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                          Comment

                          Working...
                          X