Announcement

Collapse
No announcement yet.

hs.GetPluginsList

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

    hs.GetPluginsList

    rjh

    Hi Rich, the documentation for hs.GetPluginsList indicates it returns a string array, and looking at that function using the Visual Studio object browser, it shows the same. However, running the version under linux seems to return an object. Can you confirm? This is the error message shown in linux:

    Code:
    Value of type 'Object' cannot be converted to 'System.String[]
    when using this:

    Code:
    Dim RunningPlugins() As String = hs.GetPluginsList
    Thanks
    Al
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    #2
    The end of that call returns an array:

    Return list.ToArray

    Originally posted by sparkman View Post
    rjh

    Hi Rich, the documentation for hs.GetPluginsList indicates it returns a string array, and looking at that function using the Visual Studio object browser, it shows the same. However, running the version under linux seems to return an object. Can you confirm? This is the error message shown in linux:

    Code:
    Value of type 'Object' cannot be converted to 'System.String[]
    when using this:

    Code:
    Dim RunningPlugins() As String = hs.GetPluginsList
    Thanks
    Al
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Originally posted by rjh View Post
      The end of that call returns an array:

      Return list.ToArray
      Thanks Rich, according to the MS documentation by default ToArray returns an object array: https://docs.microsoft.com/en-us/dot...y_System_Type_. Do you specify it returning a string array using ToArray(Type) ? If you do, any thoughts on why the error is thrown under linux? The example here shows it declared as an array of strings: https://help.homeseer.com/help/HS3/s...ins_getplugins, but that does not work under linux.

      Thanks
      Al
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Not sure why its confused, but you can make it work, here is a sample:

        Code:
        Sub Main(parm as object)
        dim slist as object
        
        slist = hs.GetPluginsList()
        hs.WriteLog("script","Len: " & slist.length)
        hs.writelog("script","plugin: " & slist(0))
        End Sub

        Originally posted by sparkman View Post

        Thanks Rich, according to the MS documentation by default ToArray returns an object array: https://docs.microsoft.com/en-us/dot...y_System_Type_. Do you specify it returning a string array using ToArray(Type) ? If you do, any thoughts on why the error is thrown under linux? The example here shows it declared as an array of strings: https://help.homeseer.com/help/HS3/s...ins_getplugins, but that does not work under linux.

        Thanks
        Al
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          Sparkman, for some reason I can not respond to your thread in the scripting forum (not response text box is given to me). I think this is now fixed, but earlier versions of Mono arrays did not implement IEnumerable That is why you are having the problems with Except. Take your array and create a List<string> from it and then process that, Except() should then work.

          Comment


            #6
            Originally posted by rjh View Post
            Not sure why its confused, but you can make it work, here is a sample:

            Code:
            Sub Main(parm as object)
            dim slist as object
            
            slist = hs.GetPluginsList()
            hs.WriteLog("script","Len: " & slist.length)
            hs.writelog("script","plugin: " & slist(0))
            End Sub
            Thanks Rich, yes, I can make it work under linux by either explicitly converting to a string or treating it like an object. Can the documentation be updated to show it returning an object array then, rather than a string array?

            Thanks
            Al
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              Yes, I will update the docs.

              Originally posted by sparkman View Post

              Thanks Rich, yes, I can make it work under linux by either explicitly converting to a string or treating it like an object. Can the documentation be updated to show it returning an object array then, rather than a string array?

              Thanks
              Al
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                Originally posted by rjh View Post
                Yes, I will update the docs.
                Thanks!
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  #9
                  Originally posted by bsobel View Post
                  Sparkman, for some reason I can not respond to your thread in the scripting forum (not response text box is given to me). I think this is now fixed, but earlier versions of Mono arrays did not implement IEnumerable That is why you are having the problems with Except. Take your array and create a List<string> from it and then process that, Except() should then work.
                  Thanks, will check into that. I had send a DM to macromark and Rupp a few days ago asking them to check posting permissions in that part of the forum as others had messaged me about not being able to post here: https://forums.homeseer.com/forum/de...hread?t=174916. rjh , can you take a look at that if macromark and rupp are not available?

                  Thanks
                  Al
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment

                  Working...
                  X