Jump to content

Problem with Arrays


 Share

Recommended Posts

Hey everyone I am new at AutoIt but I am having difficulty with the simplest things. I know three programming languages and can't figure out why this problem has taken up over 15 hours of my time. Could someone please explain to me why the below code gives me the error:

...

Func Parse()
    ReDim $arrayLog
    If $LastLine < _FileCountLines($Log) Then
        $file = FileOpen($Log, 0)
        For $i = $LastLine To _FileCountLines($Log)
            $arrayLog[$i-$LastLine] = String(FileReadLine($file, $i))
            GUICtrlSetData($Label1, $arrayLog[$i-$LastLine])
            GUICtrlSetData($Label2, UBound($arrayLog))
        Next
...

Gives the error ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$arrayLog[$i-$LastLine] = String(FileReadLine($file, $i))

^ ERROR

It works fine when I put $arrayLog[0] though.... which is EXACTLY what $i-$LastLine equals.... help please! And thank you in advance.

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