Jump to content
Sign in to follow this  
ArxBzFhblxphS

..

Recommended Posts

ArxBzFhblxphS
Posted Image Edited by Thanubis

Share this post


Link to post
Share on other sites
martin

How can I change an inner loop's For variable during an outer loop?

Here is the code I have. The first loop is supposed to change the For variable of the second loop before starting the second pass, but it isn't working.

#include <Array.au3>
 Opt("MustDeclareVars", 1)
 
 Global $array[50][11] = [["11","09","04","10","01","06","02","03","07","05","08"],["0","9","7","9","2","8","5","5","8","7","8"]]
 Local $iRow = 2, $index
 
 For $i1 = 1 To 2;11
     $index = _SearchArrayR($array, StringFormat("%02s", $i1))
     For $i2 = $iRow To (UBound($array, 2) - $index) + 2
         For $i3 = 0 To $index - 1
             $array[$i2][$i3] = "X"
         Next
         $index += 1
     Next
     $iRow = _SearchArrayC($array, "")
 Next
 
 _ArrayDisplay($array)
 
 Func _SearchArrayC($array, $sSearch)
     For $i = 0 To UBound($array, 1)
         If $array[$i][0] = $sSearch Then Return $i
     Next
 EndFunc ;==>_SearchArrayC
 
 Func _SearchArrayR($array, $sSearch)
     For $i = 0 To UBound($array, 2)
         If $array[0][$i] = $sSearch Then Return $i
     Next
 EndFunc ;==>_SearchArrayR

This is what the code is doing now.

Posted Image

This is what it is supposed to do.

Posted Image

So, how can I fix this? Is it even possible? Is there some other way I can achieve my goal?

Can you give a simple explanation of what you need to do? It's not obvious to me from the correct image how the required result should be achieved.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


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
Sign in to follow this  

×