Jump to content

Script error: FileClose

Guest Shantha

Recommended Posts

Guest Shantha

I understand AutoIt doesn't need a FileClose, but it is a good idea to use it.

My script open the first file in a read mode and work on it, when their is an application error occurs, it open another file to write it.

When I explicitily call the FileClose command for the readonly file, everything is okay. But, when I call FileClose for the file(s) that I am writing log, the AutoIt give an error


"Error: File handle invalid. Make sure that the FileOpen command succeeded."

Well the script runs with only one FileClose for the read only file.

Here is another case: I got this error:

"FileOpen ($errlog, 1)"

"Error: Unable to open file, the maximum number of open files has been exceeded."

In this case I understood, the script may fail to close the files. What do you think? Anyone came accross this or any ideas?

Thanks in advance,


Link to comment
Share on other sites

My guess is that you have FileOpen() in a loop so multiple calls to it are made without calling FileClose() somewhere before the end of the loop. There is a limit to the number of files that can be opened at one time. If that is the problem, then fixing this may help you to spot what is causing the first problem.

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

  • Recently Browsing   0 members

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