Jump to content
Sign in to follow this  
Jud420

Why isn't this array function working?

Recommended Posts

Jud420

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

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Monamo

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]

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Jud420

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

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  

×