Announcement

Collapse
No announcement yet.

hourly chime script

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

    hourly chime script

    this is the script
    what would i have to change to make it not play the chimes from 11pm to 5 am?


    Sub Main
    Dim h,d,chime,hour_chime

    chime = hs.GetAppPath + "\westminster_chime.wav" 'if you have a better sounding wav put it here
    hour_chime = hs.GetAppPath + "\hour_chime.wav"

    d= Time
    h = Hour(d)
    s = second(d)
    m = minute(d)

    If h > "12" Then ' strip away military time format
    h = h - 12
    End If
    hs.setvolume 20,20 ' for WAF reduces volume before playing chimes. Adjust to your liking.
    hs.waitsecs 3 ' needed to keep volume change from happening too late.
    hs.speak chime,True ' play westminster chime wav

    For i = 1 To h ' play hourly chime each time for each hour
    hs.speak hour_chime,True
    Next
    hs.waitsecs 5 ' needed to keep volume change from happening too soon.
    hs.setvolume 20,20 'change volume back so that we can hear voice announcements, etc...
    End Sub
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

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

    #2
    I have not done this myself, but here is how I would go about a first crack at this (I'm sure the more experienced people could comment on this better in the morning, I just happen to be up now).

    Save your script in the Homeseer/scripts directory.

    I would then create a new event. Go to the event properties. In the "Type:" field click "Recurring". Then in the "Trigger continuously at the given inverval", enter Run every "0" Minutes. Then click the "Reference to hour" and the "Only trigger once after the hour".

    Select "Apply Conditions to trigger" box then click on the "conditions" button.

    Select IF "Time Is".

    In the next drop down combo box select "After", then in the selection boxes to the right enter 5:00 AM. Click on the "Add" button.

    Then go back to the combo box right above the Add button and enter "Before", then select 11:00 PM. Click on the "Add Button".

    Go to the "Scripts/Speech" tab and select your script name and click on "Add Selection".

    Click on the "OK" button.

    As far as your script, you may want to look at the Homeseer help file for the command: PlayWavFileEx
    I believe it will also let you set the volume levels.
    Attached Files
    --------------------------------------------------
    **** Do You "Cocoon"? ****

    Comment


      #3
      thanks i'll try this
      FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

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

      Comment


        #4
        Fungun,

        Here is how I do it, in a simple manner. I have separate WAVs of each of the Westminster chimes for each of the hours of the day. I love them, they're wonderful. Anyway, here is the code that I use to play them only from 8AM to 9PM. The script is triggered on an hourly basis throughout the day, but the code within it determines the "active" hours.

        Best wishes,

        --David

        <pre class="ip-ubbcode-code-pre">
        '*********************************************************** *
        '* Author: David Kindred
        '* Purpose: Plays one of 12 recordings of the Westminster Chimes
        '* between the specified hours.
        '*********************************************************** *
        sub main()
        dim h

        if now() &gt; cdate(date() & " 7:55:00 AM") and now() &lt; cdate(date() & " 9:05:00 PM") then

        h = datepart("h", now())
        h = cint(h)

        if h &gt; 12 then h = h -12

        ' Lower card volume
        hs.setvolume 3,3,0

        select case h
        case 1
        hs.PlayWavFile "sounds\One.wav"
        case 2
        hs.PlayWavFile "sounds\Two.wav"
        case 3
        hs.PlayWavFile "sounds\Three.wav"
        case 4
        hs.PlayWavFile "sounds\Four.wav"
        case 5
        hs.PlayWavFile "sounds\Five.wav"
        case 6
        hs.PlayWavFile "sounds\Six.wav"
        case 7
        hs.PlayWavFile "sounds\Seven.wav"
        case 8
        hs.PlayWavFile "sounds\Eight.wav"
        case 9
        hs.PlayWavFile "sounds\Nine.wav"
        case 10
        hs.PlayWavFile "sounds\Ten.wav"
        case 11
        hs.PlayWavFile "sounds\Eleven.wav"
        case 12
        hs.PlayWavFile "sounds\Twelve.wav"
        end select

        ' Raise sound card volume back to maximum
        hs.setvolume 20,20,0
        end if
        end sub
        </pre>

        Comment


          #5
          David,
          Would you be willing to also attach your wav files and make it a complete package?
          TIA
          HH

          Comment


            #6
            HH,

            I just used dir_list.asp to check the file sizes of the WAVS. They're around 450K each. I don't think Rich would want me to use up that much space on the MB. You can contact me directly, if you'd like, and I'll be happy to send them to you. Please make sure your E-mail account can handle a ~5MB attachment.

            --David

            Comment


              #7
              David,

              My wife was just asking for something like this... everything I found online just didn't sound right, I would be extremly interested in hearing your sounds.

              Please feel free to email away!

              Comment


                #8
                thanx David
                works good
                FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

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

                Comment

                Working...
                X