(PyUNICODE,PyUNICODE,int) = GetSaveFileNameW(hwndOwner, hInstance , Filter , CustomFilter , FilterIndex , File , MaxFile , InitialDir , Title , Flags , DefExt , TemplateName )

Creates a dialog for user to specify location to save a file or files


hwndOwner=None : PyHANDLE

Handle to window that owns dialog

hInstance=None : PyHANDLE

Handle to module that contains dialog template

Filter=None : PyUNICODE

Contains pairs of descriptions and filespecs separated by NULLS, with a final trailing NULL. Example: 'Python Scripts\\0*.py;*.pyw;*.pys\\0Text files\\0*.txt\\0'

CustomFilter=None : PyUNICODE

Description to be used for filter that user selected or typed, can also contain a filespec as above

FilterIndex=0 : int

Specifies which of the filters is initially selected, use 0 for CustomFilter

File=None : PyUNICODE

The file name initially displayed

MaxFile=1024 : int

Number of characters to allocate for selected filename(s), override if large number of files expected

InitialDir=None : PyUNICODE

The starting directory

Title=None : PyUNICODE

The title of the dialog box

Flags=0 : int

Combination of win32con.OFN_* constants

DefExt=None : PyUNICODE

The default extension to use

TemplateName=None : PyResourceId

Name or resource id of dialog box template


Accepts keyword arguments, all arguments optional

Return Value

Returns a tuple of 3 values (PyUNICODE, PyUNICODE, int):
First is the selected file(s). If multiple files are selected, returned string will be the directory followed by files names separated by nulls, otherwise it will be the full path. In other words, if you use the OFN_ALLOWMULTISELECT flag you should split this value on \\0 characters and if the length of the result list is 1, it will be the full path, otherwise element 0 will be the directory and the rest of the elements will be filenames in this directory.
Second is a unicode string containing user-selected filter, will be None if CustomFilter was not specified
Third item contains flags pertaining to users input, such as OFN_READONLY and OFN_EXTENSIONDIFFERENT
If the user presses cancel or an error occurs, a win32gui.error is raised. If the user pressed cancel, the error number (ie, the winerror attribute of the exception) will be zero.