Function group Execute on client Platform(s)
FileOps NO All




Opens the standard Open file dialog.

You can specify the dialog title in cPrompt, and restrict the files displayed using a filter passed in cFilter. The filter comprises one or more entries separated by the vertical bar character '|'. Each filter entry has two components, again separated by a vertical bar. The filter entries populate the file-type selection dropdown or popup list. The first component of an entry is the text to display in the dropdown or popup list. The second component is a file-matching specification. On all platforms, a file-matching specification can have the form *.<ext>, to match all files with the extension <ext>, or *.* to match all files. On macOS, a file-matching specification can also have the form TYPE or TYPE,CREATOR, where TYPE and CREATOR are the 4 character, case-sensitive Mac file type and creator. Example cFilter parameters:

Text files|*.txt Matched all files with .txt as their extension
Text files|*.txt|Omnis Libraries|OO$A,OO$$ The first entry matches all files with .txt as their extension. The second entry matches all Omnis Studio libraries used under macOS.

You can also specify the initial directory for the Open dialog in cInitialDirectory.

The iAppflags parameter only applies when running on macOS. It is optional; if specified, it must be a combination of the following constants:

kFileOpsSelectApps Allows applications to be selectable within the dialog
kFileOpsOpenApps Allows the dialog to browse the content of applications

Note that kFileOpsOpenApps automatically implies kFileOpsSelectApps, although it is valid to specify both flags (kFileOpsSelectApps + kFileOpsOpenApps).

The name and full path of the file selected by the user is returned in the cPath parameter. Note that the file is not open: you must do something with the file name and path returned. Pathnames can be over 255 characters, which was the limit in Studio 8.0.1 or earlier.

Note that if the file selected is an alias/shortcut/link, then the returned value is the result of resolving the alias/shortcut/link to its target, not the path of the alias/shortcut/link.

$getfilename() returns true if the user selected a file and pressed OK. Otherwise, it returns false, meaning that the user pressed Cancel.


Do FileOps.$getfilename(lPath,'Please locate the Omnis help file','Help files|*.ohf',con(sys(115),'help')) Returns lError
; returns the name and full path of the file selected, e.g. 'c:\omnis\help\omnis\omnis.ohf'