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 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 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