Sign in to follow this  
Followers 0
Valuater

array sort

3 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Got it

thanks... Dickb

8)

Almost.... thanks for the help on the arraysort()

had to change this line also

IniWrite($Loc_work_file,$Sec_day, $i, $avArray[$i][1])

8)


NEWHeader1.png

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