Jump to content

Looping through a ArrayFindall result set (part 2)


Recommended Posts

Hi everyone

I am using _ArrayFindAll to gather a set of values, this works fine I now want to loop through that set of results to get the values from the indexes at certain positions, heres my result from arrayfindall












I am trying to locate the following, 1 value on its own, which would be index [0] the 1 as the next index is not a sequential number (not 2, its a 3) this one is easy as I use

;find last single

$sequencehistory[$i][0] = $a[0]

Now I don't get what I expected, I am now looking for 2 sequntial values, IE 3,4 or 8,9 in the above case it is indexes [2] & [3] which are 6 & 7

This is what I came up with but its not working

$j = 0


;find last double

If $a[$j]+1 = $a[$j+1] Then

$sequencehistory[$i][1] = $a[$j]

$j = 119; if we find 2 in a row get out of here


$j = $j+1

Until $j = 120 Or UBound($a)-1

Lastly, I am looking for 3 in a row (9,10,11 in the above data set) using this in the same Do loop

If $a[$j]+1 = $a[$j+1] And $a[$j]+2 = $a[$j+2] Then

I hope its a simple thing I am overlooking and I hope I have explained it well enough for someone more experienced to see the error/s

Many thanks in advance

Edit; sorry should have said for the 2 seq I want the value of the index that starts the seq and the 3 seq also the start value of the index it was found at

Edited by Phaser
Link to comment
Share on other sites

Issue solved, it appears I can't run a Do loop within another Do loop, the above 3 Do loops were running within one main Do loop, I have solved it by changing the Do loops to While loops and it all works as expected now.

Link to comment
Share on other sites

  • Moderators


it appears I can't run a Do loop within another Do loop

Of course you can: :graduated:

$i1 = 0
ConsoleWrite("Loop 1 = " & $i1 & @CRLF)
    $i2 = 0
        $i2 += 1
        ConsoleWrite(@TAB & "Loop 2 = " & $i2 & @CRLF)
    Until $i2 = 3

    $i1 += 1
    ConsoleWrite("Loop 1 = " & $i1 & @CRLF)
Until $i1 = 3

You might not be able to, but that is a problem in your coding - not one of AutoIt's making. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...