Jump to content

array sort


Valuater
 Share

Recommended Posts

i have been at this for hours... just can't seem to get it

i would like this

Test.ini

[Section]
4a=5
2=1
6=end
3=3
2a=2
4=4
5=6
1=begin

to look like this

Test.ini

[Section]
1=begin
2=1
3=2
4=3
5=4
6=5
7=6
8=end

this is my function

Func Set_Slip()
$avArray = IniReadSection("Test.ini", "Section")
If @error Then 
    MsgBox(4096, "", "Error occured, probably no INI file.")
EndIf

$var = $avArray[0][0]
_ArraySort($avArray[0][0],0,1)

IniDelete("Test.ini", "Section")

    For $i = 1 To $var
        IniWrite("Test.ini","Section", $avArray[$i][0], $avArray[$i][1])
    Next

Run("notepad.exe Test.ini")
EndFunc

the array sort doesn't seem to be doing its job... maybe it's me

another set of eyes might see the prob right away... thanks

8)

NEWHeader1.png

Link to comment
Share on other sites

This should do the trick.

See comments in code.

Dick ;)

#include <Array.au3>

Set_Slip()

Exit

Func Set_Slip()
    $avArray = IniReadSection("Test.ini", "Section")
    If @error Then
        MsgBox(4096, "", "Error occured, probably no INI file.")
    EndIf
    RunWait("notepad.exe Test.ini")
    
    $var = $avArray[0][0]
    _ArraySort($avArray, 0, 1, 0, 2) 
       ; Only array name needed and 
       ; need to tel sort that it's a 2 demenional array
    
    IniDelete("Test.ini", "Section")
    
    For $i = 1 To $var
        IniWrite("Test.ini", "Section", $avArray[$i][0], $avArray[$i][1])
    Next
    
    Run("notepad.exe Test.ini")
EndFunc  ;==>Set_Slip
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...