erezlevi Posted February 7, 2008 Posted February 7, 2008 (edited) please help me with this: #include <Array.au3> #include <File.au3> Dim $E[500] Dim $EREZ[500] Dim $EREZ1[500] Dim $EREZ2[500] _FileReadToArray("c:\erez1.txt", $E) _ArrayDisplay($E) $ttt = UBound($E) MsgBox(0, "this is ubound", $ttt) Dim $EREZ1[500] Dim $EREZ[500] Dim $EREZ2[500] _FileReadToArray("c:\erez1.txt", $EREZ) $E1 = _ArraySearch($EREZ, "Switch Name:", 0, 0, 1, 1) MsgBox(0, "this is $E1", $E1) For $b = 0 To 16 _ArraySwap($EREZ[$E1 + $b], $EREZ1[$b + 1]) Next For $b = 16 To 24 If $E1 + 16 + ($b - 5) > $ttt Then ExitLoop _ArraySwap($EREZ[$E1 + 16 + ($b - 5)], $EREZ1[$b + 2]) Next For $b = 24 To 31 If $E1 + 16 + ($b + 6) > $ttt Then ExitLoop _ArraySwap($EREZ[$E1 + 16 + ($b + 6)], $EREZ1[$b + 3]) Next $EREZ2 = $EREZ1 I am having problems, I need this to run even if the Array dimensions are exceeded. meaning this line not working: if $E1+16+($b-5) > $ttt then ExitLoop and if $E1 + 16 + ($b + 6) > $ttt Then ExitLoop Attached file erez1.txt that is being used here. look at the error on the console, I can't pass by it even if those lines are there in there in the For-Next. Edited February 7, 2008 by erezlevi
SadBunny Posted February 7, 2008 Posted February 7, 2008 UBound returns the NUMBER of elements, meaning it's always one greater than the last element. So, your error prevention code should be: if $E1+16+($b-5) >= $ttt then ExitLoop if $E1 + 16 + ($b + 6) >= $ttt Then ExitLoop Roses are FF0000, violets are 0000FF... All my base are belong to you.
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