Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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)

NEWHeader1.png

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...