Jump to content

OpenFile help text "ambiguous" as regards Modes 8 and 4

Recommended Posts

I have used red strike thru text to show what I think is a problem and brown bold text to show a possible solution.



Opens a text file for reading or writing.

FileOpen ( "filename", mode )


"filename" Filename of the text file to open.

mode Mode (read or write) to open the file in.

Can be a combination of the following:

0 = Read mode

1 = Write mode (append to end of file)

2 = Write mode (erase previous contents)

4 = Read raw mode

8 = Create directory structure if it doesn't exist (See Remarks).

Both write modes will create the file if it does not already exist but a non existent folder (except using mode '8' - See Remarks).

but a non existent folder will not be created (unless mode '8' is used - See Remarks).

Return Value

Success: Returns a file "handle" or use with subsequent file functions.

Failure: Returns -1 if error occurs.


Up to 64 files can be open simultaneously by one AutoIt script. Exceeding this limit throws a run-time error and

A file can only be in either read or write mode; it cannot be in both.

When opening a file in write mode, the file will be created if it does not exist.

When finished working with a file, call the FileClose function to close the file. Autoit normally closes all files upon termination, but explicitly calling FileClose is still a good idea.

When using the mode=4 (Raw Read) the filename is defined as "\\.\A:" for reading sector on a floppy disk the count must be a multiple of sector size(512). (I don't have a suggestion for the part in Italics, I think it should be examined by someone who both understands the message as well as having English as a first language. Note: NO PART of this posting is intended to be hurtful or insulting!)

None existing directory structure:



By default the file will not be created if the directory structure doesn't exist.

To overwrite this behaviour use the modes '1' and '2' together with mode-flag '8'!

For instance the mode-flag '9' (1 + 8) checks for the directory structure and if it doesn't exist creates it automatically and then opens the file for appending.


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to post
Share on other sites

H'mmmn, I was hoping someone would have responded to this by now, Oh, well, even though it's been 2 days, "A watched pot" and other old sayings. B) 'til next time.

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to post
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...