Error getting tags :
error 404Error getting tags :
error 404 ask file | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
ask file
Expander triangle

ask file prompt [with defaultFilePath] [with filter types] [as sheet]

Platform Support
MacOS,Mac OS X,Windows,Linux
Displays a standard Save dialog for the user to enter a file name and specify a location.

ask file "Please name the file:"
ask file "Save data as" with "/HD/Data Stacks/filedata.rev" as sheet
ask file empty with "Untitled"
ask file "Export picture as:" with filter "JPEG file,*.jpg"

Additional Comments
Expander triangle

Use the ask file command to let the user provide the name and location of a new file.


The prompt is a string (or any expression that evaluates to a string). If you specify empty, no prompt appears.

The defaultFilePath consists of a folder path, or a suggested file name, or both. The filename is the portion of the path after the last slash character (/). If a folder path is provided in the defaultFilePath, the dialog box shows the contents of that folder. Otherwise, it shows the contents of the last folder you used with a file dialog box. If a suggested file name is provided in the defaultFilePath, it appears in the file name box.

The types parameter specifies which extensions are available at the bottom of the dialog box. A file type consists of an optional description, a line feed or comma, and a file extension specification:


You can include more than one file type by separating the file types with commas.

Cross-platform note: The types parameter applies only to Windows systems. On Mac OS and Unix systems, this parameter has no effect.


The dialog box is the same one most applications use for the "Save" command in the File menu. (If the systemFileSelector property is set to true on Mac OS and Windows systems, and always on Unix systems, the application displays its own built-in dialog box, instead of the one provided by the operating system.)

The absolute file path of the file the user chose is placed in the it variable. If the user cancels the dialog, the it variable is set to empty, and the result function returns cancel.

Important! The ask file command does not create the file. It only displays the dialog box and retrieves the path to the file the user specifies.

Note: On Windows, it is imperative not to name a file with one of the reserved device names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8 and LPT9. Also do not use these names followed by an extension, for example, NUL.tx7.

If the as sheet form is used, the dialog box appears as a sheet on OS X systems. On other systems, the as sheet form has no effect and the dialog box appears normally. Attempting to open a sheet from within another sheet displays the second stack as a modal dialog box instead.

If the systemFileSelector property is set to false, Revolution's built-in dialog box is used instead of the operating system's standard file dialog.

Cross-platform note: On Mac OS systems where Navigation Services is in use, if you don't specify a default file name, the file name box contains "untitled". On Unix and Windows systems, the file name box is empty when the dialog box appears. Also note that Unix systems currently use Revolution's built-in dialog box.

Changes to Revolution:

The ask sheet form was introduced in version 2.0.

User Comments
Expander triangle