Announcement

Collapse
No announcement yet.

GetIniSection not working :(

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

  • GetIniSection not working :(

    Hi All,

    I am having trouble getting a GetINISection working, I want to loop through the CallTypes section of HSPI_PAGINGSERVICE.ini to extract all of the values but get the following error, what can I do to resolve this?


    Jun-16 1:02:01 PM Error Compiling script C:\HomeSeer HS3\scripts\GetScriptSection.vb: 'Count' is not a member of 'System.Array'.

    I also tried .Length instead of .Count and got the following error:

    Jun-16 1:01:27 PM Error 1 Running script C:\HomeSeer HS3\scripts\GetScriptSection.vb :Exception has been thrown by the target of an invocation.Unable to cast object of type 'System.String' to type 'System.String[]'.


    PHP Code:
    Sub Main(ByVal Parms As Object)
            
    Dim Items() As String
            Items 
    hs.GetINISection("CALLTYPES""HSPI_PAGINGSERVICE.ini")
            If 
    Items IsNot Nothing AndAlso Items.Count 0 Then
                
    For Each s As String In Items
                    
    If String.IsNullOrEmpty(sThen Continue For
                    
    hs.WriteLog("Items"s)
                
    Next
            End 
    If
         
    End Sub 
    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

    Facebook | Twitter | Flickr | Google+ | Website | YouTube

  • #2
    Something looks wrong to me somewhere, according to the documentation GetIniSection should return a string however it looks to be returning an array which is what GetIniSectionEx should instead return. The documentation shows in the GetIniSectionEx section instead "Items = hs.GetINISection("Settings", "settings.ini")" which is wrong as it should be GetIniSectionEx if the rest of the example is to go by.

    I think you have mixed it up in your code, you are calling hs.GetINISection which will return a string not an array. In the GetINISection example in the help file that return is further split up and processed, I would say change it to GetINISectionEx and see how you get on.
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P

    Comment


    • #3
      I changed it to Items = hs.GetINISectionEx("CALLTYPES", "HSPI_PAGINGSERVICE.ini") and still get the error :

      Jun-16 10:16:19 PM Error Compiling script C:\HomeSeer HS3\scripts\GetScriptSection.vb: 'Count' is not a member of 'System.Array'.
      HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

      Facebook | Twitter | Flickr | Google+ | Website | YouTube

      Comment


      • #4
        Originally posted by travisdh View Post
        I changed it to Items = hs.GetINISectionEx("CALLTYPES", "HSPI_PAGINGSERVICE.ini") and still get the error :

        Jun-16 10:16:19 PM Error Compiling script C:\HomeSeer HS3\scripts\GetScriptSection.vb: 'Count' is not a member of 'System.Array'.
        You're close.
        Use Length not Count:
        Items.Length

        Z

        Comment

        Working...
        X