asgarcymed Posted November 29, 2007 Share Posted November 29, 2007 I have 2 different paths, and I want to see (inside MsgBox) all files that are inside each path... I tried: #Include <File.au3> #Include <Array.au3> Global $paths_array [2] $paths_array [0] = "C:\test\01" $paths_array [1] = "C:\test\02" For $x = 0 To 1 $file_list_array = _FileListToArray($paths_array[$x], "*.*") For $n = 1 To $file_list_array[0] $file = $paths_array[$x] & "\" & $file_list_array[$n] MsgBox(0, "", $file) Next Next What did I get? => I see (inside MsgBox) all files that are inside $paths_array [0] = "C:\test\01" but, when it would be supposed to look at $paths_array [1] = "C:\test\02" I get nothing but an error message: CODE12) : ==> Subscript used with non-Array variable.: For $n = 1 To $file_list_array[0] For $n = 1 To $file_list_array^ ERROR How to correct this?? Thanks in advance. Best regards. MLMK - my blogging craziness... Link to comment Share on other sites More sharing options...
smashly Posted November 29, 2007 Share Posted November 29, 2007 (edited) Hi, Nothing I can see is wrong with your code providing the paths exist and the paths contain files. Maybe ad an error check to see where it's going wrong.#Include <File.au3> #Include <Array.au3> Global $paths_array [2] $paths_array [0] = "C:\test\01" $paths_array [1] = "C:\test\02" For $x = 0 To 1 Local $file = "" $file_list_array = _FileListToArray($paths_array[$x], "*.*") If @error > 0 Then MsgBox(0, "Error reading path " & $x + 1 & " to array", _ 'The return for _FileListToArray($paths_array[$x], "*.*") Error Code: ' & @error & @LF & _ "Look at _FileListToArray() function in AutoIt help file for what this error code means.") ContinueLoop EndIf For $n = 1 To $file_list_array[0] $file &= $paths_array[$x] & "\" & $file_list_array[$n] & @LF Next MsgBox(0, "Path " & $x + 1, $file) Next Cheers Edit: typos and I forgot to say Hello Edited November 29, 2007 by smashly Link to comment Share on other sites More sharing options...
asgarcymed Posted November 29, 2007 Author Share Posted November 29, 2007 Thank you very much!!! By looking at the error code, I could understand what was going bad... Regards. MLMK - my blogging craziness... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now