FileOps.$putfilename()

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

Syntax

FileOps.$putfilename(&cPath[,cPrompt,cFilter,cInitialDirectory,iAppflags])

Description

Opens the standard Save file dialog.

You can supply a default value for the file name in cPath. Pathnames can be over 255 characters, which was the limit in Studio 8.0.1 or earlier.

You can specify the dialog title in cPrompt.

You can use cFilter on Windows and Linux in a similar way to the cFilter parameter of $getfilename().

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

The iAppflags parameter is a combination of the following constants:

kFileOpsSelectApps If passed allows applications to be selectable within the dialog (macOS only)
kFileOpsOpenApps If passed allows the dialog to browse the content of applications (macOS only)
kFileOpsWindowsDisablePrompt If passed the file already exists prompt is disabled: see below* (Windows only)

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

*Studio 11 or above: When running on Windows, the dialog opened by FileOps.$putfilename() now prompts if the file already exists, unless kFileOpsWindowsDisablePrompt is passed in the iAppFlags parameter. This makes the default behavior compatible with macOS (the file already exists prompt cannot be disabled on macOS).

The name and full path of the file entered by the user is returned in cPath. Note that the file is not saved: you must write the code to output the file. $putfilename() returns true if the user selected a file and pressed OK. Otherwise, it returns false, meaning that the user pressed Cancel.

Example

Calculate lPath as  'Default.rep'
# set the default name

Do FileOps.$putfilename(lPath,'Save print file','*.rep','c:\omnis\examples') Returns lError
# opens the Save dialog with the title 'Save print file' and returns the name and full path of file entered by the user