Announcement

Collapse
No announcement yet.

Scripts with common subroutine

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

    #16
    Can't get it to work, and I seem to be duplicating what works for you guys.

    :-(
    Don

    Comment


      #17
      Originally posted by donstephens View Post
      Can't get it to work, and I seem to be duplicating what works for you guys.

      :-(
      One thing I noticed is that it appears HS doesn't always recompile the script if it hasn't changed. Try renaming test.vb to something else.
      Fred

      HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

      Comment


        #18
        Are you sure you spelled includes correctly?

        In your earlier post, you posted this for your includes code:

        Here is my Inclues\functions.vb
        Jon

        Comment


          #19
          Arrg!

          Still no luck. Makes zero sense, works for you guys, but not for me. Please see if you have the same structure as I do.

          C:\HomeSeer HS3\scripts\Includes

          Calling script: test1.vb

          Code:
          #Includes Includes/functions.vb
          	
           Sub Main(byVal args As String)
          
          	hs.WriteLog("TEST","Starting")
          
          End Sub
          functions.vb in scripts\Includes

          Code:
          	Sub LogIt(byVal Message As String, byVal Severity As Integer)
          		
          		hs.WriteLog("test","found /include")
          		Dim ID As String = "Info"
          		Dim strScript As String = "Test.vb"
          		
          		If Severity = 0 Then hs.WriteLogEx(ID," -- " & strScript &  " -- " & Message,"#80800")	'Black
          		If Severity = 1 Then hs.WriteLogEx(ID," -- " & strScript &  " -- " & Message,"#0000FF")	'Blue
          		If Severity = 2 Then hs.WriteLogEx(ID," -- " & strScript &  " -- " & Message,"#ADD8E6")	'Light Blue
          		If Severity = 3 Then hs.WriteLogEx(ID," -- " & strScript &  " -- " & Message,"#FF0000")	'Red
          		If Severity = 4 Then hs.WriteLogEx(ID," -- " & strScript &  " -- " & Message,"#FFA500")	'Orange
          			
          	End Sub
          Thanks to all for your patience.
          Don

          Comment


            #20
            Yeah, my frustrations are moving to the keyboard.

            Originally posted by jon00 View Post
            Are you sure you spelled includes correctly?

            In your earlier post, you posted this for your includes code:
            Don

            Comment


              #21
              The first line of your test1.vb should be:

              #Include Includes/functions.vb

              NOT

              #Includes Includes/functions.vb
              Jon

              Comment


                #22
                Ah, that is what you were trying to tell me.

                Sadly, still no joy, same error message.
                Don

                Comment


                  #23
                  Have you tried copying my test.vb and functions.vb I posted earlier into yours to see if they work?
                  Jon

                  Comment


                    #24
                    Yes I did, with the same error messages. Somehow, my system must be set up differently than others, in what way, I haven't a clue.

                    Originally posted by jon00 View Post
                    Have you tried copying my test.vb and functions.vb I posted earlier into yours to see if they work?
                    Don

                    Comment


                      #25
                      Originally posted by donstephens View Post
                      Yes I did, with the same error messages. Somehow, my system must be set up differently than others, in what way, I haven't a clue.
                      Hi Don, have you tried putting the file with the subroutines in the Scripts folder to rule out an issue with the paths? The include statement should look like this then:

                      Code:
                      #Include functions.vb
                      Cheers
                      Al
                      HS 4.2.8.0: 2134 Devices 1252 Events
                      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                      Comment


                        #26
                        Hi Al;
                        Yeah, just tried it. Same error. I've got to be doing something wrong. Just don't know what.
                        Don

                        Comment


                          #27
                          So it turns out that vb.net has no #include statement. Sorry to have wasted everyone's time and thanks for all the suggestions.
                          Don

                          Comment


                            #28
                            Originally posted by donstephens View Post
                            So it turns out that vb.net has no #include statement. Sorry to have wasted everyone's time and thanks for all the suggestions.
                            Does changing it to "imports" instead of "#include" work?
                            HS4Pro on a Raspberry Pi4
                            54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                            Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                            HSTouch Clients: 1 Android

                            Comment


                              #29
                              Nope, not for me. Seems to work for everyone else .
                              Don

                              Comment


                                #30
                                How about using hs.RunScript or hs.RunScriptFunc

                                http://homeseer.com/support/homeseer...ipts_runex.htm

                                http://homeseer.com/support/homeseer...scriptfunc.htm

                                It works for me on my Zee S2. I use it to initialize all my scripts on startup so I don't have to wait for things to compile the first use.

                                -Jon

                                Comment

                                Working...
                                X