Get file name

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO Windows,Linux

Syntax

Get file name (path [,dialog-title] [,file-type...]) Returns err-code

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

This command opens the standard Open file dialog for the current Operating System, in order to obtain the path of a file selected by the user. You would typically use this command to prompt the user for the path of an existing file. If you want to prompt the user to enter the path of a new file, use the Put file name command instead.

You can specify a dialog-title for the Open dialog.

The optional file-type parameter limits the choice of file types available.

Get file name returns the full pathname of the file the user selects in path, or path remains empty if no file is selected (that is, the Cancel button was clicked). The selected file is not opened.

It returns an error code (See Error Codes), or zero if no error occurs.

File types

You can specify one or more extensions (using wildcard patterns like those used in many DOS and shell commands) separated by semicolons. For example, "*.TXT" would specify text files only.

Example

; open the Get File dialog and show only omnis libraries
Get file name (lFilePath,'Select the library to open','*.lbs') Returns lErrCode
; open the Get File dialog and show only text files
Get file name (lFilePath,'Select the library to open','*.txt;*.doc') Returns lErrCode