dialog.file Shows a file dialog
Usage
dialog.file [-b] (<mode>,<caption>[,<initial_selection[,<file_filter>[,<magic1>[,<magic2>[...]]]]]]) { <callback_command> }
Description

Shows an open file dialog box with the specified <caption>, <initial_selection>, and <file_filter>.
<mode> can be open, openm, save or dir:
open causes the dialog to return an existing file
openm is similar to open but allows returning multiple files as a comma separated list
save causes the dialog to return any file name (no overwrite confirmation is built in the dialog!)
dir causes the dialog to return an existing directory name
<mode> defaults to open.
<caption> is a text string that will appear in the caption of the dialog box.
<initial_selection> can be a directory or filename that will be initially selected in the dialog.
Only files matching <file_filter> are selectable. If filter is an empty string, all files are selectable.
In the filter string multiple filters can be specified separated by either two semicolons next to each other or separated by newlines. To add two filters, one to show all C++ files and one to show all header files, the filter string could look like C++ Files (*.cpp *.cc *.C *.cxx *.c++);;Header Files (*.h *.hxx *.h++) <magic1>, <magic2>... are the magic parameters: evaluated at dialog.message call time and passed to the <callback_command> as positional parameters.
If the -b or -modal switch is specified the dialog will have non-blocking modal behaviour: it will appear above its parent widget and block its input until it's closed.
Once the dialog has been shown, the user will select an EXISTING file and click either Ok or Cancel. At this point the dialog is hidden and the <callback_command> is executed passing the selected file(s) as $0 and the magic parameters as positional parameters $1, $2, $3....
If the user clicks Cancel or does not select any file the positional parameter $0 will be empty.

Examples
dialog.file(open,Choose an audio file,/home/pragma/TheAudio.au,"Audio files (*.au *.wav *.snd)") { if("$0" != "")run play $0 }

Index, Commands