Announcement

Collapse
No announcement yet.

Automatically Update HS3 device value from HSTouch

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

    Automatically Update HS3 device value from HSTouch

    I have a text box in HSTouch that tracks the value of device A. Is there anyway to automatically update the value of Device A when the text box in HSTouch changes? I know I can setup an element in HSTouch, that when pressed, runs a script with values from elements that can update Device A's value, but this requires that the user has to click another element to force the update. I am hoping there is a way that HSTouch can automatically update Device A's value when the text box tracking Device A's value changes.

    #2
    If you look at the text box as given below. You have an action when text changed. This is where you would update the device by calling a script. This is a text box not text.

    Click image for larger version

Name:	Screenshot from 2019-12-11 10-21-30.png
Views:	223
Size:	506.1 KB
ID:	1345969

    Comment


      #3
      I have been out of town and just got back and read your response. Many many thanks, this is what I needed!!!

      Comment


        #4
        I cannot get the ActionsWhenTextChanged ot work, here is what I tested:



        Under Misc for the textbox Properties, EnterIsChange = True and IgnoreCHange = False

        The Script to be run, HSTouchTextBoxChanged.vb is:

        Sub Main(parm as string())
        hs.writelog("HSTouch","Text Box Changed")
        End Sub

        When I changed the contents of the text box and press enter, no log entry occurs in the HS log.

        Comment


          #5
          Originally posted by wmcmath View Post

          Sub Main(parm as string())
          hs.writelog("HSTouch","Text Box Changed")
          End Sub
          Just a warning here: Strings are passed differently between calling the script from an event and calling the script directly inside of HS3 Touch. Event just passes one string, HS3 Touch will pass an array of strings. Defining the subroutine one way will cause a parameter mismatch when called the other way.

          Solution is to declare the parameter as an object, then decide in code whether it is a string or string array:

          Code:
          Sub Main(parm as Object)
            If parm.GetType().ToString = "System.String" then
              ' single string called from event
            Else
             ' String array called by HS Touch
            End If
            ...

          Comment


            #6
            Thanks, I will work on this and use your code

            Comment

            Working...
            X