Announcement

Collapse
No announcement yet.

BLSpeech and Word of the Day

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

    BLSpeech and Word of the Day

    I've got BLSpeech working for simple one speak command events and scripts initiated in HS and in Stargate, but for things like the Word of the Day script it's not working too well.

    The WOTD script has several speak commands to say the word, spell the word and then again to define the word.

    How can I use BLSpeech to turn on the speakers once and then off when the WOTD script is finished?

    #2
    I take it you have run into the speakers popping on and off everytime there is a hsSpeak command.

    I've gone through all my scripts that speak and converted them to say the phrase all at once as opposed to one line at a time. Here is one of the word of the day scripts i use.

    PHP Code:
    Imports System.IO  
    Imports System
    .Xml  
    Sub Main
    (parm as object)  
        
    Dim m_xmld As XmlDocument  
        Dim m_node 
    As XmlNode  
        Dim Word 
    as xmlNode  
        Dim Deff 
    as xmlNode  
        Dim speakMsg 
    As String ""  
        
    Dim I as Integer 
       
        m_xmld 
    = New XmlDocument  
        m_xmld
    .Load("http://wordsmith.org/awad/rss1.xml")  
        
    Word m_xmld.SelectSingleNode("rss/channel/item/title")  
        
    Deff m_xmld.SelectSingleNode("rss/channel/item/description")  
       
        
    speakMsg speakMsg & ("Today's word is, <silence msec='200'/>" Word.InnerText ".")  
        
    speakMsg speakMsg & ("<silence msec='800'/>")  
        
    speakMsg speakMsg & (Word.InnerText ", is spelled, <silence msec='200'/>")  

        For 
    1 to Len(Word.InnerText)   
            
    speakMsg speakMsg & (UCase(Mid(Word.InnerText,I,1))) &", . " "<silence msec='300'/>" 
        
    next     

        speakMsg 
    speakMsg & ("<silence msec='500'/>")  
        
    speakMsg speakMsg & ("The definition is, <silence msec='500'/>" Deff.InnerText)  
        
    'hs.Speak(speakMsg)
        hs.Speak(speakMsg, True)
        speakMsg = Nothing
    End Sub 

    What you want to pay attention to is the "speakMsg"

    All you really need to do is add the -Dim speakMsg As String = ""- line and then sort of subsitiute the HsSpeak command and use the speakMsg = speakMsg & instead.
    Marty
    ------
    XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
    Playing with HS3 a bit but it's just play at this point.

    Comment


      #3
      Originally posted by nightwalker View Post
      I take it you have run into the speakers popping on and off everytime there is a hsSpeak command.

      I've gone through all my scripts that speak and converted them to say the phrase all at once as opposed to one line at a time. Here is one of the word of the day scripts i use.

      PHP Code:
      Imports System.IO  
      Imports System
      .Xml  
      Sub Main
      (parm as object)  
          
      Dim m_xmld As XmlDocument  
          Dim m_node 
      As XmlNode  
          Dim Word 
      as xmlNode  
          Dim Deff 
      as xmlNode  
          Dim speakMsg 
      As String ""  
          
      Dim I as Integer 
       
          m_xmld 
      = New XmlDocument  
          m_xmld
      .Load("http://wordsmith.org/awad/rss1.xml")  
          
      Word m_xmld.SelectSingleNode("rss/channel/item/title")  
          
      Deff m_xmld.SelectSingleNode("rss/channel/item/description")  
       
          
      speakMsg speakMsg & ("Today's word is, <silence msec='200'/>" Word.InnerText ".")  
          
      speakMsg speakMsg & ("<silence msec='800'/>")  
          
      speakMsg speakMsg & (Word.InnerText ", is spelled, <silence msec='200'/>")  
       
          For 
      1 to Len(Word.InnerText)   
              
      speakMsg speakMsg & (UCase(Mid(Word.InnerText,I,1))) &", . " "<silence msec='300'/>" 
          
      next     
       
          speakMsg 
      speakMsg & ("<silence msec='500'/>")  
          
      speakMsg speakMsg & ("The definition is, <silence msec='500'/>" Deff.InnerText)  
          
      'hs.Speak(speakMsg)
          hs.Speak(speakMsg, True)
          speakMsg = Nothing
      End Sub 

      What you want to pay attention to is the "speakMsg"

      All you really need to do is add the -Dim speakMsg As String = ""- line and then sort of subsitiute the HsSpeak command and use the speakMsg = speakMsg & instead.

      Do you need BLSpeak for this script? How can I get this to work. I am getting a script compile error "XMlDocument not defined".

      Thanks

      Comment


        #4
        No, it works with or without BLSpeech. I'm reaching here a bit as it's been awhile but check to make sure that this line "ScriptingReferences=System.XML;System.XML.dll" is in your settings.ini file in the config directory for HomeSeer.

        Also make sure you have it named as a .VB script not a txt.
        Marty
        ------
        XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
        Playing with HS3 a bit but it's just play at this point.

        Comment


          #5
          Great idea.

          I tried it and got the same error about the XmlDocument not defined even after I added the ScriptingReferences line to my settings.ini file. I then discovered that I had it in the wrong place. It needs to be in the settings section of the settings.ini file. Once I did that I got it to work.

          I had to do some experimenting in modifying it to add some additional variables to get it to work in my system. But it works great. Thanks!!

          I have not written any scripts in vb.net. Where can I find some good reference material on the differences between vbs and .net

          Comment


            #6
            I wish I could tell you that. The little I've learned so far has been with help on here and trial and error modifying other scripts to work for me. I know that tenscripting is a good resource. do a search here for it. Microsoft also offers some on-line kind of learning courses that I hear are good. If only I had the time to really get into it.
            Marty
            ------
            XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
            Playing with HS3 a bit but it's just play at this point.

            Comment

            Working...
            X