Announcement

Collapse
No announcement yet.

Script that would initiat countdown.

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

  • Script that would initiat countdown.

    A script to count the days down to a birthday, christmas, new years etc... Has anyone ever made one? I know I could edit an event for each day but is there something already out there that each day initiat and say 23 more days til ---- Then you could fill in the blank depending on what you are waiting for? Is it even possible?

  • #2
    If nobody comes up with something and your not going to make it then i will take a stab at it. Sounds like a fun script to write

    Comment


    • #3
      Hi,
      its not too bad...
      You can use the DateAdd function to add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now. To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").

      Stuart

      Comment


      • #4
        Well I dont have the capability. I have been reading alot on VBScripts but I am far from writing one from scratch. I think it would be neat to have something that could have a set day countdown and maybe a setting to say or reflect a variable. Birthday, wedding etc....XMAS!! hehe

        Comment


        • #5
          PP,
          Were you envisioning a web page interface so you could add a start date and end date?
          -Rupp
          sigpic

          Comment


          • #6
            No Rupp,
            More an announcement each day but a webpage counter would be a neat touch. Is there already a new years countdown that could be revamped?

            Comment


            • #7
              PP,
              I was thinking of an asp page that would allow you to enter a start day, end day and a spoken phrase, and the time you want it announced. Then upon submittal it would create the event for you.
              -Rupp
              sigpic

              Comment


              • #8
                Sounds like a good idea. Would be neat for my 5 year old waking up and hearing " 11 more days to Christmas!" and so on.

                Comment


                • #9
                  Ahhh Rupp, That would be just as good if not simpler interface to use. Sounds like a good approach.

                  Comment


                  • #10
                    pp,
                    Here's a real quick script that you can run in an event that will create a reminder. It's basic but you can duplicate the code any number of times you want for different events. You can put this code in a reocurring event that euns every day but it will only create the need event when the dates are appropriate. So every year it will work

                    Code:
                    sub main()
                    dtStartDate = DateValue("12-11-2004")
                    dtEndDate = DateValue("12-25-2004")
                    strTimeToAnnounce = "8:01 PM"
                    
                    intDays = dtEndDate - dtStartDate
                    
                    strWhatToSay = "It's " & intDays & " days until Christmas"
                    
                    
                    If dtEndDate >= Date Then
                        intIndex = hs.NewEvent("CountDown")
                        Set ev = hs.GetEvent(intIndex)
                        ev.misc = &H10
                        ev.ev_date = Date
                        ev.ev_time = strTimeToAnnounce
                        ev.ev_abs_time = 0
                        ev.speech = strWhatToSay
                    End If
                    end sub
                    -Rupp
                    sigpic

                    Comment


                    • #11
                      Kewl I will give it a run in the morning... Thanks alot.!

                      Comment


                      • #12
                        PP,
                        To test it simply change the strTimeToAnnounce = "8:01 PM" to a time about a minute in the future and see if it works.
                        -Rupp
                        sigpic

                        Comment


                        • #13
                          pp,
                          Found and error. You need to replace :
                          intDays = dtEndDate - dtStartDate

                          with:
                          intDays = DateDiff("d", Date, dtEndDate)
                          -Rupp
                          sigpic

                          Comment


                          • #14
                            Okay, I was just reviewing each line with my newfound script knowledge(which isn't much). Trying to go line by line to understand it....

                            Comment


                            • #15
                              If you have any questions just holler. This is a simple script in terms of number of lines but includes some semi advanced concepts.

                              BTW It just announced that Chrismas is 11 days away.
                              -Rupp
                              sigpic

                              Comment

                              Working...
                              X