Jump to content
Sign in to follow this  

filedialog - save as type

Recommended Posts


How would I split it up, so I get a list of extensions to save the file as?

instead of: txt,ini, it would be



After that I need to get the extension with a msgbox, I don't need the file path, only the extension that the user selected, is that possible? I can think of a way of how that would be done, maybe someone knows?

Share this post

Link to post
Share on other sites

FileSaveDialog() does the first bit.

There are tons of examples on how to extract extension from path, who should perform the search?

You will need to add a StringSplit()and a loop if multiple files are selected.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post

Link to post
Share on other sites


You could write your own dialog. Here is a proof of concept script using my ChooseFileFolder UDF:

#include <GUIConstantsEx.au3>
#include <Constants.au3>

#include "ChooseFileFolder.au3"

Global $aDrives = DriveGetDrive("ALL")
Global $sDrives = ""
For $i = 1 To $aDrives[0]
    ; Only display ready drives
    If DriveStatus($aDrives[$i] & '\') <> "NOTREADY" Then $sDrives &= "|" & StringUpper($aDrives[$i])

$sExt = "txt|ini"
$sDef_Ext = "txt"

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateLabel("Choose Drive", 10, 10, 90, 20)
$cCombo_Drive = GUICtrlCreateCombo("", 100, 10, 60, 20)
GUICtrlSetData($cCombo_Drive, $sDrives)
$cTreeView = GUICtrlCreateTreeView(10, 50, 200, 200)
GUICtrlCreateLabel("Choose Drive", 10, 270, 90, 20)
$cCombo_Ext = GUICtrlCreateCombo("", 100, 270, 60, 20)
GUICtrlSetData($cCombo_Ext, $sExt, $sDef_Ext)


; Register UDF message handler

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
        Case $cCombo_Drive
            $sRoot = GUICtrlRead($cCombo_Drive) & "\"
            ; Create drive treeview and wait for a selection
            $sSel = _CFF_Embed($cTreeView, $sRoot, "*.*", 12)
            $sNew_Ext = GUICtrlRead($cCombo_Ext)
            $sCurr_Ext = StringRegExpReplace($sSel, "^.*\.", "")
            ; Change extension if required
            If $sCurr_Ext <> $sNew_Ext Then
                $sSel = StringReplace($sSel, "." & $sCurr_Ext, "." & $sNew_Ext)
            MsgBox($MB_SYSTEMMODAL, "Filename", $sSel)

Please ask if you have any questions. :)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

This is one way of getting the ext used in a msg box, using iniwrite could list them for you.

Local $var = FileSaveDialog("Your File", @DesktopDir & "\", "", 1)

$ext = StringRight($var, 4)
MsgBox(0, "File Extension is", $ext)

But is sounds like you want this list in the FileSaveDialog built in.

Kinda vague

Share this post

Link to post
Share on other sites

my way to get the extension:

$file = "bla.bla2s.extension"

$FileExtension = StringSplit($file,".",1)
$FileExtension = $FileExtension[$FileExtension[0]]

MsgBox(0,"Test1",'The file extension is: "'&$FileExtension&'"')

$file = "test.txt"

$FileExtension = StringSplit($file,".",1)
$FileExtension = $FileExtension[$FileExtension[0]]

MsgBox(0,"Test2",'The file extension is: "'&$FileExtension&'"')

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...