Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

Text.AppendTextFile

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.

Component Version macOS Windows Server FileMaker Cloud FileMaker 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 value
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 Optional
The text encoding for text parameter.
Default is native.
Possible encoding names: ANSI, Arabic-Mac, Arabic-Win, Baltic-Win, CentralEurope-Mac, ChineseSimp-Mac, ChineseSimp-Win, ChineseTrad-Mac, ChineseTrad-Win, Cyrillic-Mac, Cyrillic-Win, EasternEurope-Win, Greek-Mac, Greek-Win, Hebrew-Mac, Hebrew-Win, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-15, Korean-Johab, Korean-Mac, Korean-Win, Latin1, Mac, Native, ShiftJIS-Mac, ShiftJIS-Win, Turkish-Mac, Turkish-Win, UTF-8, DOS or Windows. Pass native to use the native encoding of the current platform.
"UTF-8"

Result

Returns "OK" or an error message.

Description

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

Created 18th August 2014, last changed 16th September 2016


Text.AddLineNumbers   -   Text.CapitalCase

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins