Announcement

Collapse
No announcement yet.

Script Help

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

    Script Help

    I'm writing a script in Notepad as a text file. All executes fine when the script text file is called from within an HS3 Event. I'm calling up an xml file from the UK Met Office weather site and extracting certain data. All fine so far...

    But if I try to include a 'Goto' in the script I get an error message (1024) in the Log, referring to the line which contains the 'Goto' instruction, and saying "expected statement". Similar problem with GoSub except that gives error 13, syntax error.

    The format I've used is:

    Goto Anylabel
    ...
    Anylabel:

    Might it be that I can use just about all commands in a text script, but Goto and Gosub have to be compiled into a vbs file for branching references to work? If so, what should I use to compile my txt files, please?

    Thanks

    #2
    Are you running this as a VBS or VB .Net? There are differences.

    There are also restrictions on GoTo in VB .Net. It would be handy to see your entire function.

    Info on GoTo:

    https://docs.microsoft.com/en-us/dot...goto-statement

    Comment


      #3
      Hi - I'm very new to scripting and don't know how to answer your question about VBS or VB.Net.

      All I'm doing is writing commands in Notepad and saving this as a .txt file. Then within an Event I'm using the Run a Script Command which points to the .txt file in the HS sub-directory.

      Comment


        #4
        If it's a .txt file it is VBScript. If it has a .vb extension it is VB.NET. Maybe post your whole script so that others can review it and help point to issues. Hard to help troubleshoot without seeing it. I'd also suggest learning to write VB.NET scripts instead of VBScript. VBScript is considered a "dead" language, and most new examples you'll find on the forum are VB.NET. The HS3 Help pages do show a lot of VBScript examples though.
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #5
          From your description, it sounds like your script is more than trivial. If you plan on continuing with script development, I would recommend you look here.
          tenholde

          Comment

          Working...
          X