Jump to content

trying to count number of INI entries


Recommended Posts

hello.

brain fart.. what am i doing wrong?

trying to count the number of computer assets found in an INI (so it will count the number of entries under section names that have "_ASSETS" in the sectionname

$acount = 0
    
    $sections = IniReadSectionNames($aINI)
    For $x = 1 To $sections[0]
        $suffix = StringRight($sections[$x], 7)
        If $suffix = "_ASSETS" Then
            $asset = IniReadSection($aINI, $sections[$x])
            For $i = 1 To $asset[0][0]
                $asset_total_count = $acount + $asset[0][0]
            Next
        EndIf
    Next

    MsgBox(0, "", $asset_total_count)
Link to comment
Share on other sites

StringRight return ASSETS] and not _ASSETS. Maybe that is the problem?

Edit: Let me check... I may be wrong.

Edit2: lol. Yes, I'm wrong. ;]

$asset_total_count = 0

    $sections = IniReadSectionNames($aINI)
    For $x = 1 To $sections[0]
        $suffix = StringRight($sections[$x], 7)
        If $suffix = "_ASSETS" Then
            ConsoleWrite($sections[$x] & @LF)
            $asset = IniReadSection($aINI, $sections[$x])
            For $i = 1 To $asset[0][0]
                $asset_total_count += 1
            Next
        EndIf
    Next

    MsgBox(0, "", $asset_total_count)
Edited by Authenticity
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...