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:
     [TABLE="class: log_table_row, cellspacing: 0"]
    [TR]
    [TD="class: LogDateLong LogDateTime1, align: left"][COLOR=#000000]Sep-02 9:33:00 PM [/COLOR][/TD]
     			[TD="class: LogPri1, align: left"] [/TD]
     			[TD="class: LogType1, colspan: 3, align: left"][COLOR=#000000]Info [/COLOR][/TD]
     			[TD="class: LogEntry1, colspan: 8, align: left"] [/TD]
     		[/TR]
    [/TABLE]
    [TABLE="class: log_table_row, cellspacing: 0"]
    [TR]
    [TD="class: LogDateLong LogDateTime0, align: left"][COLOR=#000000]Sep-02 9:32:59 PM [/COLOR][/TD]
     			[TD="class: LogPri0, align: left"] [/TD]
     			[TD="class: LogType0, colspan: 3, align: left"][COLOR=#000000]Event [/COLOR][/TD]
     			[TD="class: LogEntry0, colspan: 8, align: left"][COLOR=#000000]Running script in background: /usr/local/HomeSeer/scripts/test.vb [/COLOR][/TD]
     		[/TR]
    [/TABLE]
    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