Announcement

Collapse
No announcement yet.

Does entry point exist in script?

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

    Does entry point exist in script?

    Hi, I'm attempting to write a script that will be called from HSTouch. The script will confirm that the input value matches the expected value, then act run the appropriate Event.

    The following script works when I run it from within an Event or using the tenScripting interface, but when I call the script from HSTouch, it gives the attached error.

    Code:
    Public Sub CodeCheck(ByVal MyCode As String)
            Dim MyName As String
            Dim CodeOk As Boolean
            MyName = "UNKNOWN USER"
            CodeOk = False
    
            If MyCode = "1111" Then
                MyName = "Name1"
                CodeOk = True
            ElseIf MyCode = "1112" Then
                MyName = "Name2"
                CodeOk = True
            End If
    
            If CodeOk Then
                hs.TriggerEvent("Open Screen")
            Else
                hs.TriggerEvent("Open Other Screen")
            End If
            hs.WriteLog("Alarm Code", "USER: " & MyName & "    CODE: " & MyCode)  'log the code entry
        End Sub
    Does anyone have any thoughts on what is causing this error?

    Thanks,
    Geoff
    Attached Files

    #2
    Try entering 'Main' for the script procedure rather than 'CodeCheck'
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Thank you for the suggestion, but the result is the same.

      Geoff
      Attached Files

      Comment


        #4
        That error is saying that System.String[] cannot be converted to a System.String.
        Meaning, you cannot convert an array of String objects to a String.

        Try changing:
        Public Sub CodeCheck(ByVal MyCode As String)
        to
        Public Sub CodeCheck(ByVal MyCode() As String)

        See if that works...
        HS4Pro Running on a Raspberry Pi4
        68 Z-Wave Nodes, 175 Events, 359 Devices
        UPB modules via OMNI plugin/panel
        Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
        HSTouch Clients: 3 Android, 1 Joggler

        Comment


          #5
          This give a different error...

          Thanks,
          Geoff
          Attached Files

          Comment


            #6
            Now, change:
            hs.WriteLog("Alarm Code", "USER: " & MyName & " CODE: " & MyCode) 'log the code entry
            to
            hs.WriteLog("Alarm Code", "USER: " & MyName & " CODE: " & MyCode(0)) 'log the code entry

            Since MyCode is now an array, you have to specify which element in the array...
            HS4Pro Running on a Raspberry Pi4
            68 Z-Wave Nodes, 175 Events, 359 Devices
            UPB modules via OMNI plugin/panel
            Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
            HSTouch Clients: 3 Android, 1 Joggler

            Comment


              #7
              That worked! Thank you for your assistance.

              Geoff

              Comment

              Working...
              X