Jump to content

Get a total from ini


qazwsx
 Share

Recommended Posts

I am trying to get the total number of something from an ini. The ini has many sections and each section has a key called number and a coresponding value. This is what i ahve so far to get the total.

Func _updatecount ()
    Local $count = 0
        $names = IniReadSectionNames(@ScriptDir & "\winelist.ini")
    For $i = 1 To $names[0];For each array..
        $count = $count + IniRead(@ScriptDir & "\winelist.ini", $names[$i], "Number", "")
    Next
    GUICtrlSetData($numberofbottles, "")
    GUICtrlSetState ($numberofbottles, $gui_show)
    GUICtrlSetData($numberofbottles, $count, "Error")
    
EndFunc

I think the problem is that Ini read is returning a string not a number. The label does not display anything it is not visible. If you need more code jst ask.

Link to comment
Share on other sites

  • Developers

does this work for you ?

Func _updatecount()
    Local $count = 0
    $names = IniReadSectionNames(@ScriptDir & "\winelist.ini")
    For $i = 1 To $names[0];For each array..
        $count += Number(IniRead(@ScriptDir & "\winelist.ini", $names[$i], "Number", ""))
    Next
    GUICtrlSetData($numberofbottles, $count)
EndFunc  ;==>_updatecount

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...