Gorfy Posted August 1, 2009 Share Posted August 1, 2009 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 More sharing options...
HopkinsProg Posted August 1, 2009 Share Posted August 1, 2009 If I'm not mistaken, ReDim requires you to specify a subscript. So, where ReDim $var would not work, ReDim $var[101] would work.Try changing that line to the following, and see if that helps.Redim $arrayLog[UBound($arrayLog)+1] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now