Jump to content
Sign in to follow this  
ZOTHOP

FileSaveDialog, how to add filter choosen in file name.

Recommended Posts

ZOTHOP

Hello,

Pending a lot of weeks, I searshed how to add the filter choosen with FileSaveDialog, and I didn't find a solution.

The FileSaveDialog or FileOpenDialog filters extensions only but it does not add extension automatically.

We must use : _WinAPI_GetSaveFileName() with #Include <WinAPI.au3>.

See this simple example :

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <WinAPI.au3>

#include <Array.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 212, 146, 192, 124)

$Button1 = GUICtrlCreateButton("Save", 64, 56, 75, 25)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Select

Case $nMsg=$Button1

$aFile = _WinAPI_GetSaveFileName("Save file","Text(*.txt)|OGH Files(*.ogh)")

_ArrayDisplay($aFile)

EndSelect

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

_WinAPI_GetSaveFileName open a SaveFileDialog and create an array. This array contain in [1] the path ( disk\folder(s) ), in [2] the file name and filter choosen like extension.

Edited by ZOTHOP

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.