writeFile()
Description
The writeFile() function is used to write in a file.
Syntax
JSwriteFile(path: String, content: String, append: Boolean = true) -> Boolean
 
Parameters
| Parameter | Type | Default Value | Mandatory | Description | 
| path | String | — |  | The file path. Can be an absolute or relative (relative to <path_MotorXP-AFM>/bin/assets/scripts). | 
| content | String | — |  | The content that will be written in the file. | 
| append | Boolean | true | ❌ | If true— data is added to the end of the file. Iffalse— the file is cleared before writing. | 
Return value
| Type | Description | 
| Boolean | trueif the write operation was successful. In case of an error — returnsfalse, and an error message is printed to the console. | 
Example
| JS | 
|---|
|  | let sampleText = "Sample text";
let result = writeFile("c:/temp/sample.txt", sampleText);
console.info(result);
 |