Announcement

Collapse
No announcement yet.

tenScripting 3.22 Now Available

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

    tenScripting 3.22 Now Available

    tenScripting 3.22 is now available.

    One of the most frequent questions I receive is when a script file has been added to the project folder, but the file has not been added to the project from within Visual Studio. The script file, individual scripts, and functions will appear in the drop down lists in tenScripting, but when you try and run the script it is not found because it was never compiled and loaded by Visual Studio because it was never added to the project.

    This new version attempts to identify that you are trying to Run a file that is not included in the project, and displays an error dialog.

    This version also defaults VS to give a warning for any implicit type casts. The project will still run, but warnings are listed so that you can verify that you really meant what was coded.

    As always, your comments and suggestions are welcome.

    tenholde
    tenholde

    #2
    Using a comma as a delimiter

    Hi Ed.

    I am trying to use a comma to pass multiple parameters to a script, but either I'm nuts or tenscripting is interpreting the comma as a period. As you can see in the image, the run bar has a period even though I typed in a comma.

    Or maybe it's just late, and I'm nuts.

    Don
    Attached Files
    Don

    Comment


      #3
      From the posted image, it looks like it is a period in the parameters input box?

      Ed t.
      tenholde

      Comment


        #4
        Correct. However, I typed in a comma.
        Don

        Comment


          #5
          This may be the case of the font used being cut off at the bottom of the display box, and looking like a period. Try stopping at beginning of your script and looking at the park.
          tenholde

          Comment


            #6
            This is the script I'm using
            PHP Code:
                Public Sub Main(ByVal parms As String)
                    
            'Dim ParmArray() As String

                    hs.WriteLog("Test", parms)
                    '
            ParmArray parms.ToString.Split(",")
                    
            'Dim Message As String = ParmArray(0)
                    '
            Dim strNumber As String ParmArray(1)
                    
            'Dim Severity As Integer = Integer.Parse(ParmArray(1))

                    ' 
            Dim ID As String "WakeSleep"

                    'If Severity = 0 Then hs.WriteLogEx(ID, Message, "#80800")       '
            Black
                    
            'If Severity = 1 Then hs.WriteLogEx(ID, Message, "#0000FF")  'Blue
                    
            'If Severity = 2 Then hs.WriteLogEx(ID, Message, "#ADD8E6")  'Light Blue
                    
            'If Severity = 3 Then hs.WriteLogEx(ID, Message, "#FF0000")  'Red
                    
            'If Severity = 4 Then hs.WriteLogEx(ID, Message, "#FFA500")  'Orange

                End Sub 
            The input was 'Three,Four'.
            I've commented out everything but the writelog statement, and it returns
            Three
            Changing the input to 'Three|Four' the script returns 'Three|Four'

            Hope this clarifies. :-)
            Attached Files
            Don

            Comment


              #7
              HS terminates the input parameters as soon as it sees a comma. No idea why. That's why most people use | for separated.
              tenholde

              Comment


                #8
                Understood. Will delete use of commas for delimiter.

                Thanks for looking.
                Don

                Comment


                  #9
                  How do you...

                  Hi Ed;

                  Is there a way to debug a script where #Include and Imports statements are used?

                  PHP Code:
                   #Include includes/functions.vb
                   
                  Imports System.Threading    

                   Sub Main
                  (byVal args As String)
                   
                      
                  Logit("start",1)

                      
                  Logit("stop",1)
                      
                  End Sub 
                  Don

                  Comment


                    #10
                    Originally posted by donstephens View Post
                    How do you...

                    Hi Ed;

                    Is there a way to debug a script where #Include and Imports statements are used?

                    PHP Code:
                     #Include includes/functions.vb
                    Imports System.Threading

                    Sub Main
                    (byVal args As String)

                    Logit("start",1)

                    Logit("stop",1)

                    End Sub 
                    Was this ability ever added to tenscripting?

                    Comment


                      #11
                      Imports have always worked. I'll have to look into includes
                      ​​​​​​
                      tenholde

                      Comment


                        #12
                        Originally posted by tenholde View Post
                        Imports have always worked. I'll have to look into includes
                        ​​​​​​
                        If I try it, I get this:
                        error BC30248: 'If', 'ElseIf', 'Else', 'End If', 'Const', or 'Region' expected.

                        Probably more Visual Studio than tenscripting per se, since this seems to be a HomeSeer specific directive. Just wondering if it could be made possible in tenscripting. I'm running version 3.37.

                        Sorry for replying to an obviously old instance, but this was exactly the question I was searching for.

                        Comment


                          #13
                          Please post your entire script file. I think you just have to move the imports statement
                          tenholde

                          Comment


                            #14
                            Here you go.

                            Code:
                            Public Class TestHSInclude
                            #include functions.vb
                                Public Sub Main(ByVal Parms As Object)
                                    Dim ParmArray(10) As String
                                    '' Extract script parameters into ParmArray()
                                    ParmArray(0) = ""
                                    If Parms.ToString.Contains("|") Then
                                        ParmArray = Parms.ToString.Split(Convert.ToChar("|"))
                                    Else
                                        ParmArray(0) = Parms.ToString
                                    End If
                            
                            
                                End Sub
                            End Class

                            Comment


                              #15
                              In fact the "Imports" directive is not relevant. That works fine. If you take donstephens code block from 2017 and remove the "Imports" line, you'll generate the error.

                              Comment

                              Working...
                              X