.writeFile()

Method to write a string to a file. This function can overwrite an existing file and can create new files. You can also use the method .content(). This method was originally created by Adobe.

Note:

  • Do not confuse this method with the default ExtendScript method write().
  • When using RoboHelp 8, files created with this method are encoded in iso-8859-1 encoding. Files created using RoboHelp 9 can also be encoded in iso-8859-1. You can convert files to UTF-8 using the method .convertUTF8(). The method .convertUTF8() is optimized for files created with the method .writeFile() and .content().

The method .writeFile() is located in the file file.jsxinc.

Usage

var content = "String to insert into file";
var file = new File("C:/myfile.txt");
file.writeFile(content);

Parameters

Parameter Data type Required Description
content String The string to write to the file.
encoding String   The encoding used in writing the file. When not specified the default encoding UTF-8 is used.

Return values

This function has no return values.