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. If false — the file is cleared before writing. |
Return value
Type |
Description |
Boolean |
true if the write operation was successful. In case of an error — returns false , 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);
|
Last update: 14 August 2025, 18:47