Jump to content

Why isn't this array function working?


 Share

Recommended Posts

I am trying to parse through a directory structrue where each location has a folder, which in turn has 12 folders (01-08, 02-08, 03-08, etc)--one for each month. Inside each month folder there are 3 folders -- New, Other, and Remap.

What this script is ultimately going to do is parse through each one and look for any new files downloaded since the last time the script was run and put those files into a directory tree structure, but when I run this it says that my array wasn't created properly. Whats wrong?!

$clientFolderDir = "D:\FileMaker\Client_Data_Folders\"
$mhbDumpFolder = "D:\MHB.Net DumpTemp\"
$dirSearch = ""
$currentDir = ""

;processClinic("Alaska")
$altamonteArray = processClinic("Altamonte")
;processCLinic("Austin")
;processClinic("Brookside")
;processClinic("New_Jersey")
;processClinic("New_Seasons")
;processClinic("Phoenix")
;processClinic("Reston")

func processClinic($location)
    
    Dim $clinicDirArray[14][3][50]
    $monthDirSearch = FileFindFirstFile($mhbDumpFolder & $location & "\*.")
    ConsoleWrite(FileFindNextFile($monthDirSearch))
    For $i = 0 to 12
        $clinicDirArray[$i] = FileFindNextFile($monthDirSearch)
        $clinicDirArray[$i][0] = "New"
        $clinicDirArray[$i][1] = "Other"
        $clinicDirArray[$i][2] = "Remap"
        ConsoleWrite($clinicDirArray[$i] & "\" & $clinicDirArray[$i][0] & @CR)
        
    Next    
    
    
    
EndFunc
Link to comment
Share on other sites

  • Developers

You always need to specify all 3 dimension

$clinicDirArray[$i][?][?] = FileFindNextFile($monthDirSearch)

$clinicDirArray[$i][0][?] = "New"

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I am trying to parse through a directory structrue where each location has a folder, which in turn has 12 folders (01-08, 02-08, 03-08, etc)--one for each month. Inside each month folder there are 3 folders -- New, Other, and Remap.

What this script is ultimately going to do is parse through each one and look for any new files downloaded since the last time the script was run and put those files into a directory tree structure, but when I run this it says that my array wasn't created properly. Whats wrong?!

$clientFolderDir = "D:\FileMaker\Client_Data_Folders\"
$mhbDumpFolder = "D:\MHB.Net DumpTemp\"
$dirSearch = ""
$currentDir = ""

;processClinic("Alaska")
$altamonteArray = processClinic("Altamonte")
;processCLinic("Austin")
;processClinic("Brookside")
;processClinic("New_Jersey")
;processClinic("New_Seasons")
;processClinic("Phoenix")
;processClinic("Reston")

func processClinic($location)
    
    Dim $clinicDirArray[14][3][50]
    $monthDirSearch = FileFindFirstFile($mhbDumpFolder & $location & "\*.")
    ConsoleWrite(FileFindNextFile($monthDirSearch))
    For $i = 0 to 12
        $clinicDirArray[$i] = FileFindNextFile($monthDirSearch)
        $clinicDirArray[$i][0] = "New"
        $clinicDirArray[$i][1] = "Other"
        $clinicDirArray[$i][2] = "Remap"
        ConsoleWrite($clinicDirArray[$i] & "\" & $clinicDirArray[$i][0] & @CR)
        
    Next    
    
    
    
EndFunc
Multi-dimensional arrays aren't my strong suit yet, but offhand I'd say it's because you're declaring a 3-dimensional array

Dim $clinicDirArray[14][3][50]oÝ÷ Ùú%u¼²È g§¶Ë-®ç-º·jƶv)Ȩ©Z®¶²jëh×6$clinicDirArray[$i][0] = "New"
$clinicDirArray[$i][1] = "Other"

But, again, multi-dimensionals still take a bit of effort for me to follow effectively.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

I am trying to parse through a directory structrue where each location has a folder, which in turn has 12 folders (01-08, 02-08, 03-08, etc)--one for each month. Inside each month folder there are 3 folders -- New, Other, and Remap.

You are declaring a 3D array (and array with three subscripts) but referring to it with 1D and 2D refernces. After all that, you don't return it from the function. What did you mean to accomplish with that DIM statement inside the function?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You are declaring a 3D array (and array with three subscripts) but referring to it with 1D and 2D refernces. After all that, you don't return it from the function. What did you mean to accomplish with that DIM statement inside the function?

:)

I just hadn't gotten to returning the final 3d array yet ;) thanks for the help

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...