Sign in to follow this  
Followers 0
root

Help on _ArraySort()

5 posts in this topic

When I try to Sort my 2-Dimension Array im getting this error, and dunno why...

im not expierenced with the Array UDF so maybe someone may help with this.

AutoIt Version : 3.2.2.0

Thats The Error Msg when Running the Script:

\\Path\Array.au3 (582) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Local $pivot = $array[int(($left + $right)/2)]

Local $pivot = ^ ERROR

Global $ListArray[255][2]

Func createList()
    Local $in, $Temp
    GUICtrlDelete($List1)
    $List1     = GuiCtrlCreateListView("1              ", 20, 30, 170, 200)
    $in = FileOpen(@ScriptDir & "\test.txt", 0)
    While 1
        $Line = FileReadLine($in)
        If @error = -1 Then ExitLoop
        $Temp       = StringSplit($Line, @TAB)
        $ListArray[$i][0] = $Temp[1]
        $ListArray[$i][1] = $Temp[2]
        $i += 1
    WEnd
    $Size = $i
        _ArraySort($ListArray, 0, 0, $i)
    For $i = 0 To $Size Step 1
        GUICtrlCreateListViewItem($ListArray[$i][0], $List1)
    Next
    FileClose($in)
EndFunc

Share this post


Link to post
Share on other sites



might be $i that is incorrect try a UBound to compare


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

changed the _ArraySort to

If UBound($ListArray, 1) >= $i Then _ArraySort($ListArray, 0, 0, $i)

same result

edit:

got it, missing parameter for $i_dim

Edited by root

Share this post


Link to post
Share on other sites

I am having this exact same problem right now. My 2d array is always [99][2] and I get the same error message when I try to run _ArraySort($aArray). I checked the array's contents and they look fine, so I don't know why this is happening.

Share this post


Link to post
Share on other sites

I am having this exact same problem right now. My 2d array is always [99][2] and I get the same error message when I try to run _ArraySort($aArray). I checked the array's contents and they look fine, so I don't know why this is happening.

You need to specify the number of dimensions.

_ArraySort( $avArray,0,0,0,2)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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