azoth Posted May 7, 2006 Share Posted May 7, 2006 Hi to all In the example of _FileListArray, the sample explains this : #Include <File.au3> #Include <Array.au3> $FileList= _FileListToArray(@DesktopDir) If (Not IsArray($FileList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf That's ok. But when i declare this after the test : for $i=1 to $FileList[0] If the folder is empty, AutoIt crash with this error : ==> Subscript used with non-Array variable.: for $i=1 to $FileList[0] for $i=1 to $FileList^ ERROR Why IsArry don't do her job? why i have no MsgBox? HELP ME PLEASE !!! Link to comment Share on other sites More sharing options...
Valuater Posted May 7, 2006 Share Posted May 7, 2006 try replacing this If (Not IsArray($FileList)) and (@Error=1) Then with this If (Not IsArray($FileList)) Or (@Error=1) Then 8) Link to comment Share on other sites More sharing options...
greenmachine Posted May 7, 2006 Share Posted May 7, 2006 It would also work to change the placement of the checks: If (@Error=1) And (Not IsArray($FileList)) Then The reason is because each function resets the value of @error, which means that the IsArray function sets @error to 0 (unless it fails, which isn't the case here). That's why checking for @error = 1 after the IsArray check didn't get where you wanted to, and why checking it beforehand will work. Link to comment Share on other sites More sharing options...
Valuater Posted May 7, 2006 Share Posted May 7, 2006 It would also work to change the placement of the checks: If (@Error=1) And (Not IsArray($FileList)) Then The reason is because each function resets the value of @error, which means that the IsArray function sets @error to 0 (unless it fails, which isn't the case here). That's why checking for @error = 1 after the IsArray check didn't get where you wanted to, and why checking it beforehand will work. very good green... i didn't even notice that 8) Link to comment Share on other sites More sharing options...
azoth Posted May 7, 2006 Author Share Posted May 7, 2006 Thank you very much for helping me !!! greenmachine=>I understand your precious explain but, strangely, change in placement don't working for me. On the other hand, the 'OR' solution of Valuater IS working ... Thanks a lot !! Link to comment Share on other sites More sharing options...
Valuater Posted May 7, 2006 Share Posted May 7, 2006 glad i could help... i will have to check-out greens approach for myself ... soon 8) 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