Jump to content

FileSaveDialog Variable Folder (Solved)

Recommended Posts

Hi Guys,

Point me in the right direction. I've been trying to make the FileSaveDialog command point to a variable directory.

Basically, user inserts data into the inputs, that is then read out and the directory should be created.

Then FileSaveDialog is set to save this file to that directory.


See my code and we can discuss further.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Demo", 160, 130, 192, 124)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem2 = GUICtrlCreateMenuItem("Save", $MenuItem1)
$Input1 = GUICtrlCreateInput("Input1", 8, 32, 145, 21)
$Input2 = GUICtrlCreateInput("Input2", 8, 64, 145, 21)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE

        Case $MenuItem2
    $Input1_Read = GUICtrlRead($Input1)
    $Input2_Read = GUICtrlRead($Input2)
    $path = ("C:\temp\users\")
    Local $Directory = DirCreate($path & $Input1_Read & " " & $Input2_Read & "\" & "Profile")
    $filesave = FileSaveDialog("Save File", $Directory, "Text File (*.txt)", 16, $Input1_Read & " " & $Input2_Read)



Kind Regards

"I need coffee to turn me back to a human"

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen

Link to post
Share on other sites

Your problem is: 

Local $Directory = DirCreate($path & $Input1_Read & " " & $Input2_Read & "\" & "Profile")

DirCreate returns 1 on successful creation of the directory, not the new directory path. Try this instead:

$Directory = $path & $Input1_Read & " " & $Input2_Read & "\" & "Profile"

You should check the creation was successful and have some error trapping, but with the correct input this will work.

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to post
Share on other sites
  • Skeletor changed the title to FileSaveDialog Variable Folder (Solved)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...