I have this INI file.
[MySection 1]
portion=p1
num=1
[MySection 2]
portion=p2
num=1
[MySection 3]
portion=p1
num=2
[MySection 4]
portion=p1
num=3
[MySection 5]
portion=p2
num=2
[MySection 6]
portion=p1
num=4
[MySection 7]
portion=p1
num=5
And I have this code that I wrote with the help of Mikey
To get all Sections which containing portion=p1 (Sections to which the following operation should be applied)..
Code: Select all
ini := A_Scriptdir . "\config.ini"
portion := "p1"
oldValue := "num=4" ; IN [MySection 6]
NewValue := "num=3" ; IN [MySection 4]
IniRead, sectionNames, %ini%
For each, section in StrSplit(sectionNames, "`n")
{
IniRead, text, %ini%, %section%, portion
if (text = portion) && sec := section
Section_Has_This_Value .= Sec "`n"
}
MsgBox, % Section_Has_This_Value
I want a NewValue to be incremented to the new value as if we were doing a ++ to it.
In my example num=3 should be num=4
And then do the same thing for all the values that are after the new value, and then here we get a gap that is num=3. Here we should put oldValue (num=4 should place instead of gap => num=3)...
I hope the question is clear.. Thank you very much.
Please see the picture for further clarification