Announcement

Collapse
No announcement yet.

runScriptFunc - not returing anything?

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

  • runScriptFunc - not returing anything?

    I am running the following code (Ubuntu):

    Code:
    Sub Main(ByVal Parms As Object)
      Dim test As String
      test = hs.RunScriptFunc("funksjoner.vb","Test","",FALSE,FALSE)
      hs.WriteLog ("Info", test)  
    End Sub
    my funksjoner.vb file looks like this:
    Code:
    Public Function Test(parms As Object) As Object
      Test = "Hey there"
    End Function
    But I do not get anything back, from the logfile:
    Code:
     
    Sep-02 9:33:00 PM Info
    Sep-02 9:32:59 PM Event Running script in background: /usr/local/HomeSeer/scripts/test.vb
    Any suggestions on what I'm doing wrong?

    Regards
    Tom

  • #2
    change
    Test = "Hey there" to Return "Hey there"
    tenholde

    Comment


    • #3
      Originally posted by tenholde View Post
      change
      Test = "Hey there" to Return "Hey there"
      Thanks, but unfortunately, still not working. Nothing is returned from the function.

      Comment


      • #4
        Try changing your writelog statement to:
        hs.WriteLog ("Info", test.ToString())

        You could also just change your function declare to

        Public Function Test(parms As Object) As String

        Comment


        • #5
          Originally posted by aa6vh View Post
          Try changing your writelog statement to:
          hs.WriteLog ("Info", test.ToString())
          That throws an exception:
          Exception has been thrown by the target of an invocation.Object reference not set to an instance of an object
          Public Function Test(parms As Object) As String
          Did not help, still result is blank...

          Comment


          • #6
            You need to set the 4th parameter for the RunscriptFunc to TRUE, otherwise it will not wait for a response from your function i.e.

            test = hs.RunScriptFunc("funksjoner.vb","Test","",TRUE,FALSE)
            Jon

            Comment


            • #7
              Originally posted by jon00 View Post
              You need to set the 4th parameter for the RunscriptFunc to TRUE, otherwise it will not wait for a response from your function i.e.

              test = hs.RunScriptFunc("funksjoner.vb","Test","",TRUE,FALSE)
              Yes, that solved it.

              Thank you so much!

              Comment

              Working...
              X