Jump to content

Organization


Drew
 Share

Recommended Posts

I need help organizing my lists. Their info is stored in INI files , so I'm trying to alphabetize them.

My Current "Attempt":

#Include <Array.au3>

$EneVar = IniReadSectionNames(@ScriptDir&"\Enemies.ini")
_ArraySort($EneVar, 0, 1)
_ArrayDisplay($EneVar)
For $i = 1 To $EneVar[0]
    FileWrite( @ScriptDir&"\Enemies.ini", $EneVar[$i])
    IniWriteSection( @ScriptDir&"\Enemies.ini", $EneVar[$i], 
Next

Now this will organize the sections no problem... but I can't come up with a way to have the sections keep their appropriate keys=values when I rewrite them... =/

If you can help me , I greatly appreciate your time.

Thanks,

*Drew

Link to comment
Share on other sites

#Include <Array.au3>

$iniFile = @ScriptDir & "\Enemies.ini"
$section1 = "test"

;$EneVar = IniReadSectionNames(@ScriptDir&"\Enemies.ini")
$EneVar = IniReadSection($iniFile, $section1)

_ArraySort($EneVar, 0, 1)
_ArrayDisplay($EneVar)

IniDelete($iniFile, $section1)
IniWriteSection($iniFile, $section1, $EneVar)

I now read the section content and NOT the section-NAMES

that stored in the var.

Then I sort it with you _ArraySort.

Then the old section is deleted.

Then the For loop isn't neccesary anymore because we just can put the complete array with one function into the ini again.

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

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