Jump to content
Sign in to follow this  
gcue

trying to count number of INI entries

Recommended Posts

gcue

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)

Share this post


Link to post
Share on other sites
DaRam

Well the brain fart extended to not including a sample INI/contents and what the count should be and what you are getting. :D

Share this post


Link to post
Share on other sites
Authenticity

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.