Jump to content

Recommended Posts

In order to keep the values in a one-dimensional array when making it bigger, this UDF can fit the bill. Two- or three-dimensional versions could be created from the same basic idea.

AutoItSetOption("MustDeclareVars", 1)

Func DisplayArray(ByRef $ARRAY)
    Local $I, $MSG
    For $I = 0 To UBound($ARRAY) - 1
        $MSG = $MSG & ", " & $ARRAY[$I]
    $MSG = StringTrimLeft($MSG, 2)
    MsgBox(0, "Array", $MSG)
EndFunc ;==>DisplayArray

Func Min($V1, $V2)
    If IsArray($V1) Then
    ElseIf $V1 < $V2 Then
        Return $V1
        Return $V2
EndFunc ;==>Min

Func ReDim(ByRef $ARRAY, $NEWSIZE)
    If IsArray($ARRAY) And StringIsInt($NEWSIZE) Then;Make sure of correct types
        Local $TMP = $ARRAY, $I
        Dim $ARRAY[$NEWSIZE]
        For $I = 0 To Min(UBound($TMP), $NEWSIZE) - 1
            $ARRAY[$I] = $TMP[$I]
        For $I = $I To UBound($array)-1
            $ARRAY[$I] = ""
EndFunc ;==>ReDim

Dim $R[30], $I

For $I = 0 To 29
    $R[$I] = 100 - $I


ReDim($R, 50)


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...