Announcement

Collapse
No announcement yet.

why doesn't this script work

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

    why doesn't this script work

    I have been trying to get a wav file played over the hsp ( I have the Hi Phone)

    sub main()

    hsp.LINEDial 1,"101",false
    while i < 4
    hsp.Speak 1,"This is homeseer calling at " & time,true
    hsp.Speak 1,"Time to get up, don't dally around ",true
    hsp.Speak 1,"c:\My Music\cnn.wav",true
    hs.waitsecs 3
    i=i+1
    wend
    hsp.linehangup 1

    end sub


    the first two lines are spoken properly but the last line with the WAV file is never played. Am I using the wrong command?

    Any help appreciated.

    Joe

    jjsmd@yahoo.com
    jjsmd@yahoo.com

    #2
    You can't speak a wav file you need to use something like:

    HSP can not play a wave file so use HS instead.
    <pre class="ip-ubbcode-code-pre">
    wavfile = "c:\program files\homeseer\html\wavs\cnn.wav"
    hs.PlayWavFile wavfile
    </pre>

    -Rupp
    -Rupp
    sigpic

    Comment


      #3
      Rupp:

      Thanks for the reply but when I modify the script to the following


      sub main()

      hsp.LINEDial 1,"101",false
      while i &lt; 4
      hsp.Speak 1,"This is homeseer calling at " & time,true
      hsp.Speak 1,"Time to get up, don't dally around ",true
      wavfile="c:\cnn.wav"
      hs.PlayWavFile wavfile
      hs.waitsecs 3
      i=i+1
      wend
      hsp.linehangup 1
      end sub

      what happens is that the wav file plays on the computer but not over the phone.


      A second point is that the hsp help file has the following:


      Speak
      Format

      hsp.Speak(line As Integer, text As String, wait As Boolean)

      Description

      Speaks text or a WAV file over the phone line given.

      Parameters

      line

      The phone line to speak to.

      text

      The text to speak. This may also be the full path to a WAV file to play over the phone.

      I naturally assumed it would work. Is the documentation wrong?

      Thanks

      jjsmd@yahoo.com
      jjsmd@yahoo.com

      Comment


        #4
        According to HSP documentation it should work. Sorry to mislead you. Have you checked HSP error log to see if there are any clues as to why it is not playing the file.

        -Rupp
        -Rupp
        sigpic

        Comment


          #5
          Rupp

          The log doesn't have anything. it just doesn't do anything.


          In general how do I play a wav file over the phone line?

          Joe

          jjsmd@yahoo.com
          jjsmd@yahoo.com

          Comment


            #6
            I have also noticed that if you try to use a wav file for a greeting, this doesn't work either. Don't know if these are related or not, just an observation.

            Comment


              #7
              I would email Rich on this one. I'll bet its just not been added to the new version (2.0 and up) of HSP yet.

              -Rupp
              -Rupp
              sigpic

              Comment


                #8
                Joe you would have to use hs.PlayWavFileEx to play the file. You'll need to find the device ID for the Hi-phone.

                Go into regedit, search for "Hi-Phone Desktop USB"
                look at the WAVEINID field. On mine it was 4
                so in my case it would be:

                hs.PlayWavFileEx "c:\My Music\cnn.wav",4,-1,TRUE

                Comment


                  #9
                  Thanks to you all for your replies.

                  I found that it does play over hsp, but the wav file has to be in 8 khz and 8 bit format.

                  I used windows sound recorder to convert and now it plays over hsp.

                  Joe

                  jjsmd@yahoo.com
                  jjsmd@yahoo.com

                  Comment


                    #10
                    I figured this out...

                    instead of hs.speak, use system.speak - it worked for me. It plays over the speakers, or if you're on the phone, it plays over the phone.

                    --------------
                    -=A.J. Griglak

                    Comment


                      #11
                      What does this script do exactly? Does it call you?

                      -Rupp
                      -Rupp
                      sigpic

                      Comment


                        #12
                        The script actually calls my bedroom phone( it is an extension on a Panasonic KXTD 1232) and I am using it as an alarm clock.

                        The main purpose of the script was to get experience with hsphone.


                        Joe

                        jjsmd@yahoo.com
                        jjsmd@yahoo.com

                        Comment


                          #13
                          how to do this?

                          i have a file .csv and want to parse the text after "1," in a homeseer virtual device like this:
                          this is in the file: 1,"FIREFLIES #1 owl ","=875city","http://www.radio538.nl/web/show/id994"
                          and want an output in homeseer likevirtual device) q1=FIREFLIES #1 owl

                          is this possible and how?


                          thanks edwin

                          Comment


                            #14
                            Originally posted by edwin View Post
                            i have a file .csv and want to parse the text after "1," in a homeseer virtual device like this:
                            this is in the file: 1,"FIREFLIES #1 owl ","=875city","http://www.radio538.nl/web/show/id994"
                            and want an output in homeseer likevirtual device) q1=FIREFLIES #1 owl

                            is this possible and how? thanks edwin
                            Have you looked at the HS function, StringItem?
                            Assuming the content of your file is assigned to a variable 'String', it might look something like this:

                            q1=hs.StringItem (String, 2, ",")

                            However, this may not be the result you want. If you want to assign the parsed substring to the device string of device Q1, then the line might look more like:
                            hs.SetDeviceString "q1", hs.StringItem (String, 2, ",")

                            Caveat: I haven't actually tested the above, so beware.
                            Mike____________________________________________________________ __________________
                            HS3 Pro Edition 3.0.0.548, NUC i3

                            HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                            Comment


                              #15
                              Originally posted by Uncle Michael View Post
                              hs.SetDeviceString "q1", hs.StringItem (String, 2, ",")
                              I think you would also need to remove the quotation marks:

                              MyBigString=1,"FIREFLIES #1 owl ","=875city","http://www.radio538.nl/web/show/id994"
                              MyString=hs.StringItem (MyBigString, 2, ",")
                              MyString=Replace(MyString,chr34,"")
                              MyString=Trim(MyString)
                              hs.SetDeviceString "q1", MyString
                              Jon

                              Comment

                              Working...
                              X