Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

fileDialog([application=boolean], [defaultFileName=boolean], [directoryMask=string], [mode=int], [title=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

fileDialog is undoable, NOT queryable, and NOT editable.

Displays a file picking window, and returns the name of the file that the user picked. If the user picked no file, then an empty string is returned.

Return value

string

Related

fileBrowserDialog

Flags

application, defaultFileName, directoryMask, mode, title
Long name (short name) Argument types Properties
mode(m) int create
Defines the mode in which to run the file dialog:
  • 0 for read
  • 1 for write
Write mode can not be used in conjunction with the -application flag.
directoryMask(dm) string create
This can be used to specify what directory and file names will be displayed in the dialog. If not specified, the current directory will be used, with all files displayed. The string may contain a path name, and must contain a wild-carded file specifier. (eg "*.cc" or "/usr/u/*") If just a path is specified, then the last directory in the path is taken to be a file specifier, and this will not produce the desired results.
application(app) boolean create
This is a "Mac" only flag. This brings up the dialog which selects only the application bundle.
defaultFileName(dfn) boolean create
Set default file name. This flag is available under "write" mode
title(t) boolean create
Set title text. The default value under "write" mode is "Save As". The defaule value under "read" mode is "Open".

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

cmds.fileDialog()
cmds.fileDialog( directoryMask='/usr/u/bozo/myFiles/*.ma' )
cmds.fileDialog( dm='*.cc' )