Jump to content

please help with an array issue


Recommended Posts

Hello,

please help me with this array, I'm trying to list files of different sub folders into different column's and it's making a lot of empty rows after the first column, I been trying close to 10 hours, and I can't figure out how to fix it so that it's always listed from the top.

i'm aiming to list the folder of files, number of files, and then the files.

 

I attached, the .au3 file, and screen capture of the current result with empty rows.

 

thanks in advance,

array result.JPG

 

File_Array_Lists.au3

Link to comment
Share on other sites

created same text file and folders

 

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
AutoItSetOption("MouseCoordMode", 0)




Local $LOCATON = "c:\Round_Loading"

Local $FOLDERS = _FileListToArrayRec($LOCATON, "*", 2, 1, 1, 2)

Local $FINAL[0][$FOLDERS[0]] = [[], []]

Local $sFill_FOLDERS = ""
Local $sFill_FILES = ""

For $FOLDERS_COUNT = 1 To $FOLDERS[0]
    $sFill_FOLDERS &= $FOLDERS[$FOLDERS_COUNT] & "|"
Next

$sFill_FOLDERS = StringTrimRight($sFill_FOLDERS, 1)
_ArrayAdd($FINAL, $sFill_FOLDERS)

Local $FILES1 = _FileListToArrayRec($LOCATON & "\1", "*", 1, 1, 1, 2)
Local $FILES2 = _FileListToArrayRec($LOCATON & "\2", "*", 1, 1, 1, 2)
Local $FILES3 = _FileListToArrayRec($LOCATON & "\3", "*", 1, 1, 1, 2)
For $i = 0 To UBound($FILES1) - 1
    $combine = $FILES1[$i] & "|" & $FILES2[$i] & "|" & $FILES3[$i]
    _ArrayAdd($FINAL, $combine, 0)
Next

_ArrayDisplay($FINAL, "FINAL1")
;~ Exit


Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

You can try:

#include <Array.au3>
#include <File.au3>

Local $LOCATON = InputBox("Locaton of Folders", "test", "D:\Round_Loading")
Local $aFolders = _FileListToArrayRec($LOCATON, "*", 2, 1, 1, 2)
    If @error Then Exit
Local $aFolderInfo[0][UBound($aFolders) - 1]
Local $aFolderFiles
_ArrayAdd($aFolderInfo, _ArrayToString($aFolders, "|", 1))

For $i = 0 To UBound($aFolderInfo, 2) - 1
    $aFolderFiles = _FileListToArrayRec($aFolderInfo[0][$i], "*", 1, 0, 1, 2)
        If @error Then ExitLoop
    If $aFolderFiles[0] >= UBound($aFolderInfo) + 1 Then ReDim $aFolderInfo[$aFolderFiles[0] + 2][UBound($aFolderInfo, 2)]
    For $j = 0 To $aFolderFiles[0]
        $aFolderInfo[$j + 1][$i] = $aFolderFiles[$j]
    Next
Next

_ArrayDisplay($aFolderInfo)

 

Edited by Subz
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...