Revision as of 19:42, 24 August 2020 by Max (Talk | contribs)

WriteTextFile(filename, text, append, warn, sep, showDialog, encoding)

Writes «text» value to a file with name «filename».

Optional parameters

«append»: (Default False.) If the file exists and «append» is True, it appends the text to the end of the file. If it doesn't exist, it asks whether to create the file. If «append» is False, and the file exists, and «warn» is True, it gives a warning to ask if you want to overwrite the file.

«warn»: (Default True.) If «warn» is False, it suppresses the warning that the file already exists when «append»is false or that it does not exist when «append»is True.

«showDialog»: (Default Undefined -- it shows a file browser dialog only if the indicated filename is a folder, a read-only file, or if it exists and «warn» is True. When «showDialog» is True, it always opens a dialog before with file name as the default to let the user change file name or folder. When False, it never shows a dialog but may generate an error when trying to overwrite an existing file with «append» False.

«sep»: (Default is a new line.) Character to use as a separator between elements when «text» is an array.

«encoding» (Default "ANSI".) Specifies how to encode characters in the file:
  • "ANSI" : One byte per character, ISO-8859-1. Extended characters (above ascii 255) are written as ?.
  • "UTF-8" : UTF-8 encoding with a byte order mark (BOM). The UTF-8 encoding uses one byte for comman characters, and 2-3 bytes for characters with ascii values above 127.
  • "-UTF-8" : UTF-8 encoding without a BOM.
  • "UTF-16" : Two bytes per character, big endian, with BOM.
  • "UTF-16le" : Two bytes per character, little endian, with BOM.


Introduced in Analytica 4.0.

«encoding» parameter introduced in Analytica 4.5.

See also


You are not allowed to post comments.