Announcement

Collapse
No announcement yet.

HS2 script conversion problem

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

    HS2 script conversion problem

    I have a HS2 script that I have used for years that I would like to use in HS3. It's wordOfTheDay.vb.
    I am getting this error when it runs in HS3:
    Compiling script wordOfTheDay_3.vb: Namespace or type 'System.Xml' has already been imported.
    Oct-28 7:02:46 PM Error Compiling script wordOfTheDay_3.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

    Here is the script:
    Public Sub Main(ByVal 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
    Dim attentionFileFolder As String = "wave\"
    Dim attentionFile As String = "m304.wav"
    Dim host As String = "Perseusefault"


    hs.SetDeviceValueByRef(132, 1, True)

    'folder\ filename|x|yyy where x= announcement type and yyy is volume"
    attentionFile = attentionFileFolder & attentionFile
    hs.RunScriptFunc("playMediaFile_3.vb", "Main", attentionFile & "|1|70", True, False)



    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 I = 1 To Len(Word.InnerText)
    speakMsg = speakMsg & (UCase(Mid(Word.InnerText, I, 1))) & ", . " & "<silence msec='300'/>"
    Next

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

    Any ideas on how I can get it to work in HS3 would be much appreciated!!

    #2
    What do you have listed in your ScriptingReferences inside of the setting.ini file?
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      I have this in my settings.ini
      ScriptingReferences=System.Web;System.web.dll

      I changed it to this:
      ScriptingReferences=System.Web;System.web.dll;System.Xml;Sys tem.Xml.dll

      and got this same error:
      Compiling script wordOfTheDay_3.vb: Namespace or type 'System.Xml' has already been imported.
      Oct-29 9:09:45 AM Error Compiling script wordOfTheDay_3.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases

      Comment


        #4
        Originally posted by noopara View Post
        I changed it to this:
        ScriptingReferences=System.Web;System.web.dll;System.Xml;Sys tem.Xml.dll
        Not sure if this is the cause of your problem, but I think the semi-colon after 'System.web.dll' should be a comma.

        ScriptingReferences=System.Web;System.web.dll,System.Xml;Sys tem.Xml.dll
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548, NUC i3

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

        Comment


          #5
          That didn't do it.

          I also have to have Imports System.Xml at the top of the vb file otherwise I get errors in Visual Studio/tenScripting.

          I set up Jon00 RSS HS3 plug-in and am able to get the feed from Wordsmith but I don't see where/how I can get the spelling of the word from it like my old HS2 script does.

          Comment


            #6
            Try removing all of your Scripting References.
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            Comment


              #7
              I removed the ScriptingReferences line from the settings.ini file.

              I am still getting exactly the same error:

              Compiling script wordOfTheDay_3.vb: Namespace or type 'System.Xml' has already been imported.
              Oct-29 11:43:48 AM Error Compiling script wordOfTheDay_3.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

              I have these Import statements at the top of the script file.
              Imports System.IO
              Imports System.Net
              Imports System.Xml

              I tried it without Importing System.IO and the System.Net and it made no difference

              It turns out that this problem was caused by improper use of tenScripting. I had not made the scripts part of the project. They need to be "Included" in the project. If you have a blue VB icon next to your scripts in the Solution Explorer then you are good to go.
              Last edited by noopara; October 31, 2016, 09:11 PM. Reason: I FOUND THE SOLUTION

              Comment

              Working...
              X