FileOutput - Writing Files

<< Click to Display Table of Contents >>

Navigation:  Reference (Scripting) > FileInput / FileOutput Objects for Reading and Writing Files >

FileOutput - Writing Files

The global FileOutput object provides an easy interface to create files, e.g. for writing custom data formats.


Methods and properties available for FileOutput:


Method / Property


FileOutput.CreateFile filePathName

[, rawData] [, appendData]

Create a new output file.

rawData = False (default): Open as a text file.

rawData = True: Open as a raw binary data file.

appendData = False (default): Overwrite file, if exists.

appendData = True: Append data to an existing file.


Closes the file.

FileOutput.WriteLine data

[, appendLineBreak]

Write the string data to the file.

appendLineBreak = True (default): Append a CR / LF line break after the data string

appendLineBreak = False: don't create a line break

The WriteLine method can only be used for text files (rawData = False).

FileOutput.WriteByte data

Write the byte data to the file.

result = FileOutput.IsOpen

Returns True if a file is open, False if not.

result = FileOutput.Dialog([caption] [, defaultPath] [, fileFilter])

Shows a "File Save" dialog and return the chosen file path, or an empty string, if aborted.

The default value for fileFilter is:

All Files (*.*)|*.*

result = FileOutput.FileExists(filePath)

Returns True, if filePath exists.




When FileInput.CreateFile cannot open the file, it produces an error and script execution stops.


See the FileInput object for an example.