Announcement

Collapse
No announcement yet.

VB Script Error Method arguments must be enclosed in parentheses.

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

    VB Script Error Method arguments must be enclosed in parentheses.

    The following code returns "Method arguments must be enclosed in parentheses" in the error catch. I am having trouble isolating the problem. Any help would be appreciated

    HS4 Standard Edition 4.2.0.0 (Windows)
    Running on Win 10


    I think the error is with the with end with but I don't see anything obvious:

    Code:
    Sub Main(parm as object)
    
    dim objXML
    dim objNodes
    dim objNode
    dim logname="Traffic XML Error"
    
    try
    objXML = CreateObject("MSXML2.DOMDocument.6.0")
    
    [B]With objXML
    .SetProperty "SelectionLanguage", "XPath"
    .ValidateOnParse = True
    .Async = False
    .Load "C:\Program Files (x86)\Homeseer HS4\scripts\traffic.xml"
    End With[/B]
    
    
    objNodes = objXML.SelectNodes("/channel/item/description")
    For Each objNode In objNodes
    hs.writelog("Traffic XML", objNode.ParentNode.GetAttribute("decription")& " " & objNode.Text)
    Next
    
    
    Catch ex As Exception
    'Error trapping
    hs.WriteLogEx(logName, ex.ToString, "#ff0000")
    End Try
    
    End Sub
    .

    Thanks

    Will

    #2
    I don't know the particulars of your Object structure, but a couple thing to focus on.

    I've added highlighted parenthesis
    Code:
    With objXML
        .SetProperty[COLOR=#c0392b]([/COLOR]"SelectionLanguage", "XPath"[COLOR=#c0392b])[/COLOR]
        .ValidateOnParse = True
        .Async = False
        .Load[COLOR=#c0392b]([/COLOR]"C:\Program Files (x86)\Homeseer HS4\scripts\traffic.xml"[COLOR=#c0392b])[/COLOR]
    End With
    Make sure the filename ends with ".vb".

    Also in the hs.WriteLog, "description" is missing an "s".

    Comment


      #3
      Thank you. That worked

      Comment

      Working...
      X