Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Files.CanOpenFile
Checks if plugin can read file.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Files | 5.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Files.CanOpenFile"; Path ) More
Parameters
Parameter | Description | Example |
---|---|---|
Path | The native file path to the file. | $path |
Result
Returns 1, 0 or error.
Description
Checks if plugin can read file.The plugin tries to open file exclusive. If that fails another application or FileMaker has the file open.
Returns 1 if open was okay, 0 if file is busy or an error like permissions denied.
If you just need to know whether you can open a file, you can just read it. Or test by opening with BinaryFile.Open function.
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
Check if file exists:
Show Custom Dialog ["File exists"; MBS( "Files.CanOpenFile"; "/Users/cs/Desktop/test.rtf" )]
See also
Blog Entries
This function checks for a license.
Created 20th October 2015, last changed 15th August 2023