App.OpenFile
------------

Asks app to open a given file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [App](component_App.md) | [7.4](newinversion74.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

MBS( "App.OpenFile"; Path ) 

**MBS**( **"App.OpenFile";** /\* Asks app to open a given file. \*/  
**$Path**) /\* The native file path to the file to open.e.g. "/Users/cs/Desktop/test.fmp12" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native file path to the file to open. | "/Users/cs/Desktop/test.fmp12" |

### Result

Returns OK or error.

### Description

Asks app to open a given file.  
This happens asynchronously, so we have no idea if it works or not.  
FileMaker may show error dialogs.  
This call must be last in a script as you can’t open a file while a script is running, the file should open when the script is done. You can use [FM.RunScriptLater](FMRunScriptLater.md) to run a script in a few seconds to follow up. There you can check with [window](component_Window.md) functions and see if there is a new window in front.  
  
See also [Files.Launch](FilesLaunch.md) and [Files.LaunchFile](FilesLaunchFile.md).  
  
Check also the [Shell](component_Shell.md) functions to run command line tools and get the output. This may work on the server, where the normal launch function may not work due to missing GUI.  
  
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.  
### Examples

Open a database:

 Set Variable \[ $r ; Value: MBS ("App.OpenFile"; "/Users/cs/Desktop/test.fmp12") \]  
### See also

- [Files.Launch](FilesLaunch.md)
- [Files.LaunchFile](FilesLaunchFile.md)
- [FM.RunScript](FMRunScript.md)
- [FM.RunScriptLater](FMRunScriptLater.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 7.4**
    - Added [App.OpenFile](http://www.mbsplugins.eu/AppOpenFile.shtml) for Mac to open file in FileMaker by script.

### Blog Entries

- [MBS FileMaker Plugin, version 7.4pr3](https://www.mbsplugins.de/archive/2017-08-22/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 21st August 2017 , last changed 8th August 2020

  
[App.MemoryUsed](AppMemoryUsed.md) - [App.PlaySystemSound](AppPlaySystemSound.md)

[HTML Version](AppOpenFile.shtml)