bbj40.gif FILESAVE() Function - Create File Save Dialog


Syntax

FILESAVE(prompt,path,name,ext[,filters[,mode]])

Syntax (BBj 7.0 and higher)

FILESAVE(prompt,path,name,ext[,filters[,mode[,MODE="CLIENT"]])

Description

The FILESAVE function activates the standard File Save dialog.

Parameter

Description

prompt

Text to display in the title bar of the dialog.

path

Default directory for the file to be saved in the dialog.

name

Default name for the file to be saved in the dialog. Use the empty string ("") to avoid setting a default filename.

ext

Default extension (usually 3 characters, do not include the dot) for the file to be saved in the dialog. Use the empty string ("") to avoid setting a default extension.

filters

One or more filters in the following format:

"text description" + $0a$ + "mask" [+$0a$ + "text description" + $0a$ + "mask" …]

The mask specifies an extension, in the format "*.ext" or "*.*"; two or more masks are separated with semicolons. The filter, if included, indicates which files will appear in the list.

For example:

REM Illustrate the use of the FILESAVE() function

 REM Build filters for brc/arc and all files
 FILTER$="Binary Resource Files"+$0a$+"*.brc;*.brf"
 FILTER$=FILTER$+$0a$+"ASCII Resource Files"+$0a$+"*.arc"
 FILTER$=FILTER$+$0a$+"All Files (*.*)"+$0a$+"*.*"

 REM Staring directory is the default Directory
 FILE_DIR$=""

 REM Use FILESAVE() to get name of file to save
 FILE_NAME$=FILESAVE("Save Resource File",FILE_DIR$,"","",FILTER$)

 REM display file name returned
 PRINT FILE_NAME$

mode

In BBj 5.0 and higher, select whether file, directories, or files and directories are selectable using the file dialog. The available options for mode are:

0 only files may be selected

1 only directories may be selected

2 files or directories may be selected

 

Note: The default setting is 0. When setting mode to 1 or 2, the filters option is ignored.

For example:

 

REM Illustrate the use of the FILESAVE() function to select only directories

 

 REM Set the mode to directories only

 MODE=1

 

 REM The filters parameter is ignored when selecting directories only

 FILTER$=""

 

 REM Starting directory is the default Directory

 FILE_DIR$=""

 

 REM Use FILESAVE() to get name of directory

 FILE_NAME$=FILESAVE("Save Directory",FILE_DIR$,"","",FILTER$,MODE)

 

 REM display file name returned

 PRINT FILE_NAME$

MODE="CLIENT"

In BBj 7.0 and higher - if this option is present, the FILESAVE dialog will show files on the client's filesystem instead of the server's system. If this option is omitted, the FILESAVE dialog will show files on the server's filesystem.

When the dialog is dismissed, this returns  "::BAD::" (error encountered), "::CANCEL::" (user clicked Cancel), or the fully qualified path of the selected file. If the user chooses a name that already exists, overwrite is confirmed. This dialog does not actually cause any files to be saved but returns the name the user has selected.

In BBj 2.02 and higher, the FILESAVE function and mnemonic is localized according to current STBL("!LOCALE") setting. For more information, see Localization.

For more information, see FILEOPEN Mnemonic - Create File Open Dialog, Mnemonic Groupings, and STBL Formats - BBj