Announcement

Collapse
No announcement yet.

&hs.RunScriptFunc () Question

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

    &hs.RunScriptFunc () Question

    In the following script what do the parameters mean and what is their purpose:

    &hs.RunScriptFunc ("PhoneTest.vb","PhoneTest","pause",False,False)

    Obviously we are running PhoneTest.vb script from homeseer scripts directory but what is the purpose and meaning of "PhoneTest","pause",False,False?
    What does each of these parameters mean and are they all necessary to run PhoneTest.vb script and how do they all affect the running of the script? Thanks much for the help !!!!!!!!! Rick
    Last edited by Rick Bonari; January 14, 2018, 12:26 AM.

    #2
    Hi Rick - Listed below is the end user documentation for the parameters for RunScriptFunc. HS3 Script documentation can be found online at:
    https://homeseer.com/support/homesee...lp/default.htm


    Public Function RunScriptFunc(ByVal Script As String, ByVal Proc As String, _
    ByVal Params As Object, ByVal Wait As Boolean, _
    ByVal SingleInstance As Boolean) As Object


    Purpose
    This procedure runs another script and specifies a procedure to run in that script and optional parameters. This will also return a value from the called script.

    Scripts must be located in the scripts directory in the HomeSeer application directory (C:\Program Files\HomeSeer 3\Scripts by default).

    Parameters
    Parameter: Script
    Type: String
    Description: This is the file name of the script to run. Do not include the path in the script name.
    Parameter: Proc
    Type: String
    Description: This is the name of the procedure (Sub or Function) to execute. If this is left blank, the procedure "Main" will be run.
    Parameter: Params
    Type: Object
    Description: This is a parameter or a set of parameters to send to the procedure. This can be a string or numeric value, or even an array of different values.
    Optional Parameter: Wait
    Type: Boolean
    Description: When set to TRUE, the script that is calling hs.RunScriptFunc will not continue processing commands until the script referenced here is finished. Set this to False to allow the script using hs.RunScriptFunc to continue as soon as the other script is launched.

    Optional Parameter: SingleInstance
    Type: Boolean
    Description: When set to TRUE, only one instance of the script referenced by hs.RunScriptFunc can be running at a time, so if there is one instance already running, calling this again will result in an empty/null return and an error message written to the log.
    Returns
    Return value: Value
    Type: Object
    Description: This returns any value (numeric, string, object) that the called script returns if the called procedure is a function.

    Comment


      #3
      Originally posted by Rick Bonari View Post
      In the following script what do the parameters mean and what is their purpose:

      &hs.RunScriptFunc ("PhoneTest.vb","PhoneTest","pause",False,False)

      Obviously we are running PhoneTest.vb script from homeseer scripts directory but what is the purpose and meaning of "PhoneTest","pause",False,False?
      What does each of these parameters mean and are they all necessary to run PhoneTest.vb script and how do they all affect the running of the script? Thanks much for the help !!!!!!!!! Rick
      As per the documentation in the above post, the "Phonetest" is the name of the procedure to run in script "Phonetest.vb". If you've written your script using the usual "Sub Main", then there is no Phonetest sub or proc in your script, and the &hs.RunScriptFunc will always fail! Use "Main" instead of "Phonetest" and you should be good.
      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


        #4
        Thanks to the both of you!!!! Would this be correct to run the simple script PhoneTest.vb:

        &hs.RunScriptFunc("PhoneTest.vb",False,False)

        Doesn't seem from the above descriptions that I would need the "pause" parameter. I see a wait parameter but not pause. What is the purpose of pause instead of wait or are they the same? Again don't see reference to pause. Thanks again !!!! Rick
        Last edited by Rick Bonari; January 14, 2018, 07:11 PM.

        Comment


          #5
          I think I'd just use &hs.RunScript("PhoneTest.vb") unless you really need the extra parms available in &hs.runscriptfunc.

          Is there a reason you're using &hs.runscriptfunc instead of just using the event function for "run a script or script command"?

          To answer your question, though: No, I don't think that would work. If you're going to "skip" a parm, you need to put the commas and a blank or null in anyway, so it passes a "null" or blank parm. So this would work to run a script named "test-phone-dial-digits.vb" with a Sub of "Main":

          &hs.RunScriptFunc("test-phone-dial-digits.vb","Main"," ",False,False)
          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


            #6
            ITguyHS,

            I'm not going to use this method but was wanting to clarify how this command works for possible future use. Thanks again for your clarifications !!!!! Rick

            Comment

            Working...
            X