This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

FileNameSetter

FileNameSetter[name]
represents a file name setter which displays as a Browse button and when clicked brings up a system file opening dialog, starting from the location corresponding to name.
FileNameSetter[Dynamic[name]]
uses the dynamically updated current value of name, with the value of name being reset if a different file is chosen.
FileNameSetter[name, "Save"]
brings up a file saving dialog.
FileNameSetter[name, "spec", {"type1"->{"patt11", "patt12", ...}, "type2"->{...}, ...}]
looks for files of types typei with names matching the file patterns pattij.
  • In FileNameSetter[name, "spec"]possible specifications of dialogs to use are:
"Open"file opening dialog (default)
"OpenList"multiple file opening dialog
"Save"file saving dialog
"Directory"directory picking dialog
  • In FileNameSetter[name, "spec"], name is normally a single complete file name string.
  • In FileNameSetter[name, "OpenList"], name is always a list of file name strings.
  • FileNameSetter[name, "Save"] generates a warning if the file picked already exists.
  • If the file browser dialog is closed without choosing a file name, FileNameSetter leaves name unchanged.
  • If no file type specification is given, the file browser dialog will list files of all types.
  • The typei give the names of filters to be listed in the file browser, and to be used for picking out files whose names match the file patterns specified.
  • The following options can be given:
BaseStyle{}base style specifications for the setter
AppearanceAutomaticthe appearance of the file name setter
EnabledAutomaticwhether the setter is enabled, or grayed out
ImageMargins0margins around the displayed setter
ImageSizeAutomaticoverall size of the displayed setter
WindowTitleAutomaticthe title of the browser window
  • With the setting Appearance->"form", the string "form" will be used in place of "Browse...".
  • Other expressions given as settings for Appearance are used literally as the appearance of the unclicked FileNameSetter.
  • Filenames in FileNameSetter use the pathname separator appropriate for your computer system.
  • The settings for BaseStyle are appended to the default style typically given by the "FileNameSetter" style in the current stylesheet.
Assign the full path of a file to a variable:
In[1]:=
Click for copyable input
Out[1]=
 
Assign the full path of multiple files to a variable:
In[1]:=
Click for copyable input
Out[1]=
 
Assign the full path of a new file without actually creating it:
In[1]:=
Click for copyable input
Out[1]=
 
Assign the full path of a directory to a variable:
In[1]:=
Click for copyable input
Out[1]=
New in 6