Announcement

Collapse
No announcement yet.

End of statement Expected

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

    End of statement Expected

    Can anyone help with this?
    Works fine in Windows but not in Linux.

    Code:
    Sub MuteTog (ByVal Parms() As String)   
        Dim theZone As Double = parms(0)
        Dim curVol As Double = hs.DeviceValueEx(theZone)
        Dim lastVol As String
                if curVol > 0 then
                    hs.CreateVar("volSet")
                    lastVol = hs.SaveVar("volSet",curVol)
                    Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(theZone, True, "(value)", False, False)
                    cc.ControlValue = 0
                    Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
                Elseif curVol = 0 then
                    lastVol = hs.GetVar("volSet")
                    Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(theZone, True, "(value)", False, False)
                    cc.ControlValue = lastVol
                    Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
                    hs.DeleteVar("volSet")
                End if
    End Sub
    Getting End of Statement Expected.

    #2
    Have you tried coping over the working script file from Windows to Linux? You may have a hidden character on the page in the Linux version
    Jon

    Comment


      #3
      I Have.
      It's the same file.

      Comment


        #4
        If you remark out all the lines except:
        Code:
         
         Sub MuteTog (ByVal Parms() As String)    
         End Sub
        Does that run?
        Jon

        Comment


          #5
          If not try:

          Code:
           Sub MuteTog (ByVal Parms As Object)
           End Sub
          Jon

          Comment


            #6
            Originally posted by jon00 View Post
            If you remark out all the lines except:
            Code:
            Sub MuteTog (ByVal Parms() As String)
            End Sub
            Does that run?
            No. Same error

            If not try:

            Code:
            Sub MuteTog (ByVal Parms As Object) End Sub
            Same error

            Comment


              #7
              How is the sub being called? Via an event? If so you cannot send a string array via this method.
              Jon

              Comment


                #8
                From a button press in HSTouch.
                Keep in mind, it works in Windows.

                BLRussound plugin doesn't have a mute function ( why not?? ) so I use this script to toggle mute.

                Comment


                  #9
                  Can you show me the button code you are using?
                  Jon

                  Comment


                    #10
                    I have the text on the button invisible but it is the refID of the audio zone volume.
                    The button press sends that refID to the script.
                    Click image for larger version

Name:	Capture.PNG
Views:	170
Size:	212.9 KB
ID:	1365147

                    Comment


                      #11
                      I'm at a loss then.

                      Code:
                      Sub MuteTog (ByVal Parms As Object)
                      End Sub
                      If the above fails, then there must be a bug as an object should accept any parameter type.
                      Jon

                      Comment


                        #12
                        Thanks for trying!

                        Comment


                          #13
                          It could of course be a mono issue but that is difficult to diagnose.
                          Jon

                          Comment


                            #14
                            Originally posted by Demusman View Post
                            Thanks for trying!
                            Just a note: HS Touch passes parameters to scripts as an array of strings, whereas a Homeseer event passes only the parameter as a single string. Makes for a small bother when you want to call a routine from both sides.

                            I use the following code to handle calls from both sides:

                            Code:
                            Public Sub AlarmDefault(parms As Object)
                              Dim buff As String, iValue As Double
                              If parms.GetType().ToString = "System.String" Then
                                buff = parms.ToString()
                              Else ' parms is an Array of string
                                buff = parms(0).ToString()
                              End If
                              iValue = CDbl(buff)
                            End Sub
                            Note that other than the Main subroutine, I declare other subroutines "Public" if I want to call them directly from Touch or an event.

                            Try something like that. If it still fails, it would be interesting to actually see the error message you are getting in the HS log.

                            Comment


                              #15
                              Got a feeling it's a Mono issue. None of my scripts are working. All of them worked fine in Windows. Haven't really played with it at all today but I'll give your suggestion a try when I can.

                              There error is the title of this post.

                              Comment

                              Working...
                              X