RichText.ReadFile
-----------------

Reads a text file from a file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RichText](component_RichText.md) | [3.0](newinversion30.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "RichText.ReadFile"; Path ) 

**MBS**( **"RichText.ReadFile";** /\* Reads a text file from a file. \*/  
**$Path**) /\* The native file path to the file. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native file path to the file. | $path |

### Result

Returns OK or error message.

### Description

Reads a text file from a file.  
The plugin uses Mac [system](component_System.md) functions to read text files including plain text files, RTF files, Word files in doc or xml format, webkit archives or OpenOffice documents.  
If you want the user to select a path, please use [FileDialog](component_FileDialog.md) functions.  
  
See also [Files.ReadJPEG](FilesReadJPEG.md), [Files.ReadPDF](FilesReadPDF.md), [Files.ReadPNG](FilesReadPNG.md), [Text.ReadTextFile](TextReadTextFile.md) and [Files.ReadFile](FilesReadFile.md).  
  
Warning: The plugin can only read/write the styles/formats which Apple supports for their cocoa framework.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) 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](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Read formatted text from container field:

 $r = MBS ( "RichText.ReadFile"; "/Users/Desktop/test.txt" )  
$text = MBS ( "[RichText.FormattedText](RichTextFormattedText.md)" )  
### See also

- [Container.ReadFile](ContainerReadFile.md)
- [Files.ReadFile](FilesReadFile.md)
- [Files.ReadJPEG](FilesReadJPEG.md)
- [Files.ReadPDF](FilesReadPDF.md)
- [Files.ReadPNG](FilesReadPNG.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [RichText.ReadRTF](RichTextReadRTF.md)
- [RichText.ReadText](RichTextReadText.md)
- [RichText.ReadURL](RichTextReadURL.md)
- [RichText.WriteFile](RichTextWriteFile.md)

### Example Databases

- [Mac only/RichText/RichText](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/RichText/RichText.shtml#2ScriptAnchor_)

This function checks for a license.

Created 18th August 2014 , last changed 14th August 2017

  
[RichText.ReadContainer](RichTextReadContainer.md) - [RichText.ReadFromClipboard](RichTextReadFromClipboard.md)

[HTML Version](RichTextReadFile.shtml)