Jump to content

How can i get total of all keys of IniReadSection?


Recommended Posts

 

For $i = 1 To 1000
$List = IniReadSection(@DesktopDir&"\AllsaleAmount.ini","DATA")
$Total = $List[1][1] ++ $List[1][$i]
Next
MsgBox(0,"total",$Total)

 

I am trying like this but i got error( Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$Total = $List[1][1] ++ $List[1][$i]) in console.

Edited by Starstar

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

  • Moderators

Can you please provide an example of what info out of the INI you're trying to get? Rather than the $i = 1 To 1000 route, why not use the 2d array returned from IniReadSection directly? $List[0][0] will tell you how many elements you have, And it is always in a key/value pair - [$i][0] = Key and [$i][1] = Value.

 

If you need to stick with this method, change your $List[1][$i] call around; the way you have it written, you would be looking for $List[1][999] at some point, which isn't going to exist of course.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Starstar,

From the Help file for IniReadSection:

The number of elements returned will be in $aArray[0][0]

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

JLogan3o13,

My most hearty congratulations on your achievement.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Starstar,

Assuming all the elements are numeric, you can do it like this:

$Total_Keys = 0
$Total_Values = 0
$List = IniReadSection(@DesktopDir & "\AllsaleAmount.ini", "DATA")
For $i = 1 To $List[0][0]
    $Total_Keys += $List[$i][0]
    $Total_Values += $List[$i][1]
Next
MsgBox(0, "total", $Total_Keys & @CRLF & $Total_Values)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Starstar,

Assuming all the elements are numeric, you can do it like this:

$Total_Keys = 0
$Total_Values = 0
$List = IniReadSection(@DesktopDir & "\AllsaleAmount.ini", "DATA")
For $i = 1 To $List[0][0]
    $Total_Keys += $List[$i][0]
    $Total_Values += $List[$i][1]
Next
MsgBox(0, "total", $Total_Keys & @CRLF & $Total_Values)

M23

​Thanks to all and special thanks to Melba23 problem solved.........

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

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