Announcement

Collapse
No announcement yet.

Script parameters without using events?

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

    #16
    Originally posted by tenholde View Post

    That HsTouch passed parameters differently if you have only one, versus more than one.
    Frankly, I have not passed parameters from HS Touch yet (but will be doing so shortly). However, when I was experimenting with it yesterday, GetType on parms returned a simple string type (not an array) when the parameter list was empty. Actually did surprise me. Expected a "null object".

    Of course if you use an Object like I described, it will not make any difference.

    Here is expanded code for handling input from both HS3 and HS Touch. Assuming that HS3 will pass a single string, with the three parmeters separated by commas (i.e. "A,B,C"), and HS Touch will pass three strings (in one array of strings):

    Code:
    Public Sub Main(ByVal parms As Object)
      Dim P1 As String = "", P2 As String = "", P3 As String = ""
      If parms.GetType().ToString = "System.String" Then
        Dim P() As String = parms.ToString().Split(",")
        P1 = P(0)
        P2 = P(1)
        P3 = P(2)
      Else
        P1 = parms(0).ToString
        P2 = parms(1).ToString
        P3 = parms(2).ToString
      End If
      ...
    End Sub

    Comment


      #17
      All right, got home, and ran a quick test. You are right that one parameter does use a string array ("System.String[]"). Bad assumption on my part. However, no parameters does still use an empty, simple string ("System.String").

      Comment


        #18
        Originally posted by aa6vh View Post
        All right, got home, and ran a quick test. You are right that one parameter does use a string array ("System.String[]"). Bad assumption on my part. However, no parameters does still use an empty, simple string ("System.String").
        Thanks for checking. I am not running HsTouch, so had no way to verify.
        tenholde

        Comment

        Working...
        X