Announcement

Collapse
No announcement yet.

Cannot use parentheses when calling a Sub

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

    Cannot use parentheses when calling a Sub

    I'm having the error:

    Running script, script run or compile error in file: heatingcompleate.txt1044:Cannot use parentheses when calling a Sub in line 182 More info: Cannot use parentheses when calling a Sub


    the lines which are at fault are below, starting line 180:

    if boiler = "On" then
    hs.WriteLog "boiler","boiler going on"
    hs.SetdeviceValue("H32",2)
    end if

    Can anyone see where I'm going wrong???

    #2
    Is your script vbscript or vb.net? I think you might have have slightly confused syntax, this is vbscript;

    if boiler = "On" then
    hs.WriteLog "boiler","boiler going on"
    hs.SetdeviceValue "H32", 2
    end if

    And this would be vb.net

    if boiler = "On" then
    hs.WriteLog("boiler","boiler going on")
    hs.SetdeviceValue("H32", 2)
    end if

    Comment


      #3
      Thanks again Mr Happy, that now works a treat

      Comment


        #4
        Yeah even though I would consider myself to be pretty good at coding, I still goof that up.

        I believe it has to do with WHICH script engine is executing the script.

        The fun part is in the Immediate Console area. There you have to do BOTH.

        I tend to "check" things quite a bit...as I'm developing a complex script. So, in that window I put a lot of:

        hs.writelog "test", devicevalue("device")

        Notice that the writelog THERE does NOT have (), but the second part (second script to be executed) REQUIRES the ().

        --Dan
        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

        Comment


          #5
          I tend to avoid vbscript now and go straight for .net but the way I remember it (I think this is the case anyway) is for vbscript if it returns a value then it needs brackets/parentheses/call it what you want (hs.devicevalue in vbscript needs to be hs.devicevalue("V1")), if you are just setting something (hs.setdevicevalue/hs.writelog have no return types) then you don't need them.

          If you go vb.net then you don't need to worry, everything needs 'em.

          Comment


            #6
            Originally posted by drozwood90 View Post
            Yeah even though I would consider myself to be pretty good at coding, I still goof that up.

            I believe it has to do with WHICH script engine is executing the script.

            The fun part is in the Immediate Console area. There you have to do BOTH.

            I tend to "check" things quite a bit...as I'm developing a complex script. So, in that window I put a lot of:

            hs.writelog "test", devicevalue("device")

            Notice that the writelog THERE does NOT have (), but the second part (second script to be executed) REQUIRES the ().

            --Dan
            If you are doing any kind of significant .net script development for HomeSeer, you should look at: http://www.tenholder.net/tenWare2/tenScripting

            tenholde
            tenholde

            Comment


              #7
              Thanks Ten. I tend to do most of my development ON my server itself.

              As such, I don't want to install any of the Visual Studio stuff on there (even Express).

              I just "feel" that it takes so many resources.

              If I could install on my laptop and develop/test, then deploy to the server...maybe, but I don't know if that's possible.

              --Dan
              Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

              Comment


                #8
                It was designed to be used on a separate development computer. It connects to HS across your LAN and allows you to debug your script on your development computer and then export it to your homeseer computer only after it is fully tested. You only need to install the HS speaker app on your development computer.

                Tenholde
                tenholde

                Comment


                  #9
                  I personally find it to be an excellent tool, one of many tenholde provides.

                  It allows you to code/debug as if you were on the server without 'being' on the server as well as provides the invaluable framework of MS debugging tools and intellicode help.

                  Once you been able to step through a real-time functioning script and see variable values, states, etc. using breakpoints and other debugging tools you'll never look back.

                  And as he mentioned it has a built in tool to deploy the code directly to the server once completed. Great stuff.

                  The learning curve pays back in big dividends, IMHO.

                  Comment


                    #10
                    Ten,

                    You suggest "FREE Visual Basic 2008 Express Edition or the FREE Visual Web Developer 2008 Express Edition"

                    Why do I want one over the other? Is one for doing ASP pages and one for doing scripts?

                    Also, I see that 2010 is out. Should I stick with 2008?

                    --Dan
                    Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                    Comment


                      #11
                      I just haven't updated the documentation. It has been tested under VS 2010 Express, and I would suggest you use that.
                      tenholde

                      Comment


                        #12
                        OK regarding 2010.

                        I guess my question was more, what is the Web Developer used for Vs. VB? I've used VB .net, understand what it can/cannot do. Is there some kind of advantage that I should want to get the Web Developer as well?

                        --Dan
                        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                        Comment


                          #13
                          I only tested it under Web developer briefly because someone already had it installed and wanted to know if it would work.

                          No matter which of the products you use, you can only develop scripts using tenScripting -- not plugins nor web pages.


                          VS 2010 Express is used to develop windows programs and Web Developer to develop aspx pages. Either can be used to host tenScripting.

                          tenholde
                          tenholde

                          Comment


                            #14
                            gotcha...now I understand.

                            --Dan
                            Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                            Comment

                            Working...
                            X