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.

Details and Options

  • 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.
  • FileNameSetter["",] uses no initial file name.
  • If no name is given that determines a valid directory, FileNameSetter uses as a default $UserDocumentsDirectory.
  • 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:
  • AppearanceAutomaticthe appearance of the file name setter
    BaseStyle{}base style specifications for the 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.
  • FileNameSetter is intended primarily for use with local kernels.
  • File names in FileNameSetter use the pathname separator appropriate for your computer system.
  • FileNameSetter[] is equivalent to FileNameSetter["","Open"].
  • Setting can be used to find the file name specified by FileNameSetter.
  • The settings for BaseStyle are appended to the default style typically given by the "FileNameSetter" style in the current stylesheet.

Examples

open allclose all

Basic Examples  (4)

Assign the full path of a file to a variable:

Assign the full path of multiple files to a variable:

Assign the full path of a new file without actually creating it:

Assign the full path of a directory to a variable:

Scope  (1)

Specify the file types and patterns:

Wolfram Research (2007), FileNameSetter, Wolfram Language function, https://reference.wolfram.com/language/ref/FileNameSetter.html.

Text

Wolfram Research (2007), FileNameSetter, Wolfram Language function, https://reference.wolfram.com/language/ref/FileNameSetter.html.

CMS

Wolfram Language. 2007. "FileNameSetter." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileNameSetter.html.

APA

Wolfram Language. (2007). FileNameSetter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileNameSetter.html

BibTeX

@misc{reference.wolfram_2024_filenamesetter, author="Wolfram Research", title="{FileNameSetter}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/FileNameSetter.html}", note=[Accessed: 17-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_filenamesetter, organization={Wolfram Research}, title={FileNameSetter}, year={2007}, url={https://reference.wolfram.com/language/ref/FileNameSetter.html}, note=[Accessed: 17-December-2024 ]}