Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Text.AppendTextFile
Appends a text file with the given text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Text | 2.8 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Text.AppendTextFile"; Text; FilePath { ; encoding } ) More
(old name: String.AppendTextFile)
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Text | The text to save. | "Hello World" | |
FilePath | The native file path. Something like "/Users/cs/desktop/test.txt" on Mac and "C:\Programs\Data\test.txt" on Windows. Files without path end in the root directory on Mac. | "test.txt" | |
encoding | The text encoding for text parameter. Default is native. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | Optional |
Result
Returns "OK" or an error message.
Description
Appends a text file with the given text.You have to decide which encoding to use (if not native). We support a few encodings, but we can add more if you need something special.
If the file does not exist, it will be created. You can use this function for logging to a text file.
Please use Text.ReplaceNewline to define which line endings the file has.
This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Examples
Write UTF-8 file with some text:
MBS("Text.AppendTextFile"; $Text; $Path; "utf8" )
Write a test text file:
MBS("Text.AppendTextFile"; "Hello World. Some umlauts: äöü"; "/Users/cs/Desktop/testfile.txt"; "native")
See also
- BinaryFile.Append
- FM.DataViewerContent
- HotKey.SetEvaluate
- Path.FileMakerPathToNativePath
- Text.ReadTextFile
- Text.ReplaceNewline
- Text.WriteTextFile
Release notes
- Version 12.2
- Changed Text.AppendTextFile, Text.WriteToContainer and Text.WriteTextFile to allow writing BOM character.
Blog Entries
- MBS FileMaker Plugin, version 12.2pr1
- Watching for Errors with MBS Plugin
- FileMaker 18 File Script Steps vs. BinaryFile functions
- Evaluate vs. Script Trigger
- Filemaker: Export Text to File
- MBS Filemaker Plugin, version 2.8fc
This function is free to use.
Created 18th August 2014, last changed 4th August 2023