Announcement

Collapse
No announcement yet.

Using Subroutines in Scripts

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

  • Using Subroutines in Scripts

    Could someone provide me with an example of how to call a subroutine from a .vb script and pass arguments ?
    Where do i put the script that is the called subroutine?


    In one use, the subroutine would only be called from one script and in another use, the subroutine would be called from multiple scripts
    I am assuming that if a subroutine wold only be called from within the same script, it would have a different structure than if the subroutine were available to multiple scripts.



  • #2
    For calling a local subroutine/function example:

    Code:
    Private Function Foo(ByVal iParam As Integer) As Integer
      Return iParam + 1
    End Function
    Sub Main(parms As Object)
      Dim I As Integer = Foo(1)
      hs.WriteLog("Test", CStr(I))
    End Sub
    Have not yet tried calling external subroutines, so I will let someone else answer that.

    Comment


    • #3
      Here is a good discussion on the subject.

      https://forums.homeseer.com/forum/ho...mon-subroutine

      Comment

      Working...
      X