Jump to content

_ArrayUnique crashes


 Share

Recommended Posts

This script:

#include <File.au3>
#include <array.au3>


Global $aFile

_FileReadToArray(@AppDataDir& "\2dSum.txt", $aFile)
;_ArrayDisplay($aFile)
Global $a2D[$aFile[0]][2]
_ArrayDelete($aFile, 0)
For $i = 0 To UBound($aFile) - 1
    $aSplit = StringSplit($aFile[$i], " ", 2)
    $a2D[$i][0] = $aSplit[0]
    $a2D[$i][1] = $aSplit[1]
Next


;Summierung
$aRes = _ArraySum2D($a2D)
_ArrayDisplay($aRes, "Summen")

Func _ArraySum2D(ByRef $avArray)
    Local $sActCol, $iActCol = -1, $sRes, $iRes
    Local $aTmp = _ArrayUnique($avArray)
    _ArrayDelete($aTmp, 0)
    _ArraySort($aTmp)
    Local $aRes[2][UBound($aTmp)]
    For $i = 0 To UBound($aTmp) - 1
        $aRes[0][$i] = $aTmp[$i]
    Next
    For $i = 0 To UBound($avArray) - 1
        For $j = 0 To UBound($aRes, 2) - 1
            ConsoleWrite($avArray[$i][0] & @TAB & $avArray[$i][1] & @CRLF)
            If $aRes[0][$j] = $avArray[$i][0] Then $aRes[1][$j] += $avArray[$i][1]
        Next
    Next
    Return $aRes
EndFunc   ;==>_ArraySum2D

crashes with:

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Program Files\AutoIt3\Include\Array.au3" (2297) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
If IsInt($aArray[$iBase]) Then
If IsInt(^ ERROR
->04:19:11 AutoIt3.exe ended.rc:1

used file for testing: 2sum.txt, I am sure it worked under 3.3.6.x now i have 3.3.14.1

Edited by AutoBert
Link to comment
Share on other sites

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • Moderators

AutoBert,

To save you trouble of looking in Trac, just upgrade to 3.3.14.2.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I tried to update, but download allways fails, i am mobile in Inet with speed of 64 kbits/s.

After this i downloaded the zip and updated this way, but the zip  seems to be 3.3.14.1:

>Running:(3.3.14.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Bert\AutoIt3.My\2Dsum.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Program Files\AutoIt3\Include\Array.au3" (2297) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
If IsInt($aArray[$iBase]) Then
If IsInt(^ ERROR
->10:37:40 AutoIt3.exe ended.rc:1
+>10:37:40 AutoIt3Wrapper Finished.

  

Link to comment
Share on other sites

  • Moderators

AutoBert,

To keep you going until you can download, the fix was pretty simple - just replace the relevant lines within your current _ArrayUnique function with these:

; Autocheck of first element
    If $iIntType = $ARRAYUNIQUE_AUTO Then
        Local $vFirstElem = ( ($iDims = 1) ? ($aArray[$iBase]) : ($aArray[$iColumn][$iBase]) )
        If IsInt($vFirstElem) Then
            Switch VarGetType($vFirstElem)
                Case "Int32"
                    $iIntType = $ARRAYUNIQUE_FORCE32
                Case "Int64"
                    $iIntType = $ARRAYUNIQUE_FORCE64
            EndSwitch
        Else
            $iIntType = $ARRAYUNIQUE_FORCE32
        EndIf
    EndIf
    ; Create error handler
    ObjEvent("AutoIt.Error", "__ArrayUnique_AutoErrFunc")
    ; Create dictionary

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

AutoBert,

The least I can do seeing it was my error that caused the problem.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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