Sign in to follow this  
Followers 0
qazwsx

Get a total from ini

3 posts in this topic

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.

Share this post


Link to post
Share on other sites



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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

yeh thx a lot. I dont really see how that is different tho lol.

Edited by sccrstvn93

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  
Followers 0