Announcement

Collapse
No announcement yet.

Check if date is a holiday

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

    Sorry but it says there is a syntax error "5/8/2005 11:24:22 PM~!~Error~!~Script error in file: myHoliday.txt: 1002:Syntax error in line 490"
    Thanx
    Tim
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

    Comment


      Figured it out
      Thanx Sparkman for pointing me in the right direction.
      What I had to do was add some of that code you wrote me to the "wakeup2.txt" script and it works.
      Cool
      Thanx again
      Tim
      FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

      HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

      Comment


        Well i spoke alittle soon
        I got it to work with the current day/date but not for future days.
        This is the script, the changes I made are in red.

        "#Include includes/isholiday.vbs

        ' ---------------------------------------------------------------------------
        ' Filename: wakeup2.txt
        ' By: JohnWPB
        ' Created: 15-12-2003
        ' Updated: 25-01-2004
        ' Version: 1.3
        ' Use: Announces/Reminds of upcoming events
        ' Home: HomeSeer Message Board - Script Library
        ' Instructions: Save in HomeSeer /scripts directory.
        ' Create a HomeSeer event to run the script
        ' Requirements: Homeseer, isholidays.ini in HomeSeer /config folder
        ' isholidays.vbs in /scripts/includes folder
        ' Updates: Version 1.1 - Modified by Al Vonkeman to allow the announcement
        ' of multiiple events on the same day
        ' Version 1.2 - - Modified by Al Vonkeman to use RemindPrior parameter
        ' Version 1.3 - - Modified by Al Vonkeman to check 'time' parameter before announcing
        ' ---------------------------------------------------------------------------

        Sub main()


        Dim i
        Dim MyDay
        Dim MyDayName
        Dim test

        ihName = 0
        ihAnnounce = 1
        ihAnnouncement = 2
        ihChangeBehavior = 3
        ihRemind = 4
        ihImage=5
        ihRemindPrior=6
        ihEmail=7
        ihPrivate=8
        ihINI=9
        ihTime=10
        ihPerson=11
        ihHowManyYearsString=12
        ihHowManyYearsNumber=13

        MyDay = Weekday(Date)
        MyDay = MyDay -1

        ' this section just gets the name by day, so if it is 7 days away it will
        ' say [holiday] is next [day name]

        if MyDay = 0 then MyDayName= "Sunday "
        if MyDay = 1 then MyDayName= "Monday "
        if MyDay = 2 then MyDayName= "Tuesday "
        if MyDay = 3 then MyDayName= "Wednsday "
        if MyDay = 4 then MyDayName= "Thursday "
        if MyDay = 5 then MyDayName= "Friday "
        if MyDay = 6 then MyDayName= "Saturday "


        ' ***************Today *******************
        myDate = Date
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihAnnounce) = True Then
        TempTime = ""
        On Error Resume Next
        TempTime = CDate(Holiday(i,ihTime))
        If TempTime = "" Or DateDiff("n",TempTime,Time) < 0 Then hs.speak Holiday(i,ihAnnouncement) & "."
        hs.SetDeviceString "y30",Holiday(i,ihName)
        End If
        Next
        Else
        ' hs.speak "there are no events today. "
        hs.SetDeviceString "y30","NO NOTICES TODAY"
        End If

        ' ***************Tomorrow *******************
        myDate = DateAdd("d",1,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 1 Then hs.speak " Tomorrow is " & Holiday2(i,ihName) &"."
        Next
        End If

        ' ***************Day After Tommorrow *******************
        myDate = DateAdd("d",2,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 2 Then hs.speak " The day after tomorrow is " & Holiday(i,ihName) &"."
        Next
        End If

        ' ***************3 days away *******************
        myDate = DateAdd("d",3,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 3 Then hs.speak Holiday(i,ihName) & " is three days away."
        Next
        End If

        ' ***************4 days away *******************
        myDate = DateAdd("d",4,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 4 Then hs.speak Holiday(i,ihName) & " is 4 days away."
        Next
        End If

        ' ***************5 days away *******************
        myDate = DateAdd("d",5,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 5 Then hs.speak Holiday(i,ihName) & " is 5 days away."
        Next
        End If

        ' ***************6 days away *******************
        myDate = DateAdd("d",6,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 6 Then hs.speak Holiday(i,ihName) & " is 6 days away."
        Next
        End If

        ' ***************7 days away *******************
        myDate = DateAdd("d",7,Date)
        Holiday = WhichHolidays(myDate)
        If IsArray( Holiday ) Then
        For i = 0 To uBound(Holiday) - 1
        If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 7 Then hs.speak Holiday(i,ihName) & " is next " & MyDayName
        Next
        End If


        end sub"

        I can not get it to work in the days below "Today"
        I have the virtual devices made, but I keep getting errors about if's, syntax errors, expected 'next', and so on.

        Thanx
        Tim
        FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

        HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

        Comment


          I just downloaded the newest version of isholiday and installed it. For some unknown reason, I can't seem to get it working. Using the wakeup2.txt script to call the isholiday.vbs (located in the /script/includes folder) does not generate any notices (I created one for testing) and although I can call up the cal.asp, no appointments are shown there either.

          This looks like a very useful script if I can get it working, but it looks like I need help. I've double checked all the file locations and they seem to be in the proper places.
          Regards, Bob

          Comment


            In playing around with the ini file, it looks like the [Holiday] section must preceed the other sections. It seems to work know.
            Regards, Bob

            Comment


              I got it to work
              Now have virtual devices that I can do whatever with.
              Below is getting them to the Beta Brite sign.
              Thanx
              Tim

              http://forums.homeseer.com/showthread.php?t=103686
              FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

              HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

              Comment


                Originally posted by itanic
                In playing around with the ini file, it looks like the [Holiday] section must preceed the other sections. It seems to work know.
                Hi itanic,

                I changed my file around so that the [Holiday] section is no longer the first section and it still works ok for me... Not sure why on your system that section has to be first. The script uses a standard INI function to read in that section and it should pick it up from anywhere in the file.

                Cheers
                Al
                Last edited by sparkman; May 19, 2005, 07:53 PM.
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  Originally posted by fungun
                  I got it to work
                  Hi Tim,

                  Sorry I missed your last few posts. Glad you got it working. What ended up being the problem?

                  Cheers
                  Al
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment


                    Had to change the "wakeup2.txt" script.
                    The part I changed are in 'red' then repeated for each section.
                    Tim

                    "#Include includes/isholiday.vbs

                    ' ---------------------------------------------------------------------------
                    ' Filename: wakeup2.txt
                    ' By: JohnWPB
                    ' Created: 15-12-2003
                    ' Updated: 25-01-2004
                    ' Version: 1.3
                    ' Use: Announces/Reminds of upcoming events
                    ' Home: HomeSeer Message Board - Script Library
                    ' Instructions: Save in HomeSeer /scripts directory.
                    ' Create a HomeSeer event to run the script
                    ' Requirements: Homeseer, isholidays.ini in HomeSeer /config folder
                    ' isholidays.vbs in /scripts/includes folder
                    ' Updates: Version 1.1 - Modified by Al Vonkeman to allow the announcement
                    ' of multiiple events on the same day
                    ' Version 1.2 - - Modified by Al Vonkeman to use RemindPrior parameter
                    ' Version 1.3 - - Modified by Al Vonkeman to check 'time' parameter before announcing
                    ' ---------------------------------------------------------------------------

                    Sub main()


                    Dim i
                    Dim MyDay
                    Dim MyDayName
                    Dim test

                    ihName = 0
                    ihAnnounce = 1
                    ihAnnouncement = 2
                    ihChangeBehavior = 3
                    ihRemind = 4
                    ihImage=5
                    ihRemindPrior=6
                    ihEmail=7
                    ihPrivate=8
                    ihINI=9
                    ihTime=10
                    ihPerson=11
                    ihHowManyYearsString=12
                    ihHowManyYearsNumber=13

                    MyDay = Weekday(Date)
                    MyDay = MyDay -1

                    ' this section just gets the name by day, so if it is 7 days away it will
                    ' say [holiday] is next [day name]

                    if MyDay = 0 then MyDayName= "Sunday "
                    if MyDay = 1 then MyDayName= "Monday "
                    if MyDay = 2 then MyDayName= "Tuesday "
                    if MyDay = 3 then MyDayName= "Wednsday "
                    if MyDay = 4 then MyDayName= "Thursday "
                    if MyDay = 5 then MyDayName= "Friday "
                    if MyDay = 6 then MyDayName= "Saturday "


                    ' ***************Today *******************
                    myDate = Date
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihAnnounce) = True Then
                    TempTime = ""
                    On Error Resume Next
                    TempTime = CDate(Holiday(i,ihTime))
                    If TempTime = "" Or DateDiff("n",TempTime,Time) < 0 Then hs.speak "Today is" & Holiday(i,ihAnnouncement) & "."
                    hs.SetDeviceString "y30",Holiday(i,ihName)

                    End If
                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y30","NO REMINDERS"
                    End If


                    ' ***************Tomorrow *******************
                    myDate = DateAdd("d",1,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 1 Then hs.speak " Tomorrow is " & Holiday(i,ihName) &"."
                    hs.SetDeviceString "y31",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y31","NO REMINDERS"
                    End If





                    ' ***************Day After Tommorrow *******************
                    myDate = DateAdd("d",2,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 2 Then hs.speak " The day after tomorrow is " & Holiday(i,ihName) &"."
                    hs.SetDeviceString "y32",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y32","NO REMINDERS"
                    End If

                    ' ***************3 days away *******************
                    myDate = DateAdd("d",3,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 3 Then hs.speak Holiday(i,ihName) & " is three days away."
                    hs.SetDeviceString "y33",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y33","NO REMINDERS"
                    End If



                    ' ***************4 days away *******************
                    myDate = DateAdd("d",4,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 4 Then hs.speak Holiday(i,ihName) & " is 4 days away."
                    hs.SetDeviceString "y34",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y34","NO REMINDERS"
                    End If



                    ' ***************5 days away *******************
                    myDate = DateAdd("d",5,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 5 Then hs.speak Holiday(i,ihName) & " is 5 days away."
                    hs.SetDeviceString "y35",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y35","NO REMINDERS"
                    End If


                    ' ***************6 days away *******************
                    myDate = DateAdd("d",6,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 6 Then hs.speak Holiday(i,ihName) & " is 6 days away."
                    hs.SetDeviceString "y36",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y36","NO REMINDERS"
                    End If


                    ' ***************7 days away *******************
                    myDate = DateAdd("d",7,Date)
                    Holiday = WhichHolidays(myDate)
                    If IsArray( Holiday ) Then
                    For i = 0 To uBound(Holiday) - 1
                    If Holiday(i,ihRemind) = True And CInt(Holiday(i,ihRemindPrior)) >= 7 Then hs.speak Holiday(i,ihName) & " is next " & MyDayName
                    hs.SetDeviceString "y37",Holiday(i,ihName)

                    Next
                    Else
                    ' hs.speak "there are no events today. "
                    hs.SetDeviceString "y37","NO REMINDERS"
                    End If



                    end sub"
                    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                    Comment


                      Holiday Virtual Device

                      Sparkman,

                      I really like your calendar add-on, i added the small calendar into my quick view and show the previous month, this month, and next months calendar. It fits like a charm and is good for the WAF as well.

                      I attempted to use your snippit of code to set a virtual device to inidcate a holiday to help keep up the WAF. She was a little annoyed with the chimes and lights being activated today (this being Victoria Day). Unfortunately, I suffered the same demise as fungun and recieved the following error.
                      5/23/2005 2:33:28 PM~!~Error~!~Script error in file: Holiday_Today.txt: 1002:Syntax error in line 484

                      I looked at both the isholiday.vbs and this code, but do not see the issue.
                      Any thoughts ?

                      Thanks

                      Steven

                      Try something like this:


                      Code:


                      #Include includes/isholiday.vbssub main()
                      Holidays = ""myDate = DateHoliday = WhichHolidays(myDate)If IsArray( Holiday ) Then
                      For i = 0 To uBound(Holiday) - 1
                      HolidayName = Holiday(i,0)Holidays = Holidays & ". " & HolidayName
                      Nexths.SetDeviceString "z2",Holidays
                      ElseIf
                      hs.SetDeviceString "z2","Nothing"
                      End If
                      end sub
                      </PRE>




                      </PRE>

                      Comment


                        Hi karls,

                        Glad you like the calendars. Can you email me your script (or is it exactly like mine) and ini file? The formatting of the message board looks like it messed it up a bit in your post. Send it to sparkweb at shaw dot ca

                        Cheers
                        Al
                        HS 4.2.8.0: 2134 Devices 1252 Events
                        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                        Comment


                          Sparkman,

                          Wow ! Fast response.
                          I actually did a cut and paste off of the board. So it is identical to yours.

                          Steven

                          Comment


                            Hi Steven,


                            I just tried a cut and paste from what I had posted on the message board and the formatting gets messed up slightly. Did you correct it to look like what is posted?

                            Cheers
                            Al
                            HS 4.2.8.0: 2134 Devices 1252 Events
                            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                            Comment


                              Al,

                              That was actually the first thing that I had noticed.
                              So yes, it has been reformatted to look exactly like what was posted.
                              I have sent a copy to your email address as well.

                              Steven

                              Comment


                                Just came up. It is announcing that today is Memorial Day, but it is not till next Monday. The ini file says this-"Memorial Day=May,Monday,4". The prob is there are 5 mondays this May.
                                Is there a way to reconfigure this or just edit the ini.
                                Thanx
                                Tim
                                FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                                HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                                Comment

                                Working...
                                X