Jump to content

AutoIt error: "unable to open file, the maximum number of open files has been exceeded."


Recommended Posts

Hi, I´m working in a script to process in batch multiple files, but we are receiving the following message, always in the file number 944 (see the attachment)

0000108: AutoIt error: "unable to open file, the maximum number of open files has been exceeded."

I found this reference in google:

http://bugtracker.driverpacks.net/view.php?id=108

I´m using autoit 3.1.1.0

any help ? is it a bug ? any idea ?

best

post-20810-1171735340_thumb.jpg

Link to comment
Share on other sites

That is no bug. You should only be using FileFindFirstFile() once. After that, you use that open file handle and pass it to FileFindNextFile().

This is the example from the help file:

; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile("*.*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)

The script has to be written in that format. Open the handle with FileFindFirstFile(), then loop it with FileFindNextFile(), and when you are done you close the still open file handle with FileClose(). Opening more than 64 files at a time is not allowed by autoit. Opening more than that many files is just a huge problem anyway and it shouldn't be done.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

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