Skeletor Posted July 7, 2017 Share Posted July 7, 2017 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) GUICtrlSetData($Input1,"") $Input2 = GUICtrlCreateInput("Input2", 8, 64, 145, 21) GUICtrlSetData($Input2,"") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit 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) EndSwitch WEnd Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
SlackerAl Posted July 7, 2017 Share Posted July 7, 2017 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" DirCreate($Directory) You should check the creation was successful and have some error trapping, but with the correct input this will work. Skeletor 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Skeletor Posted July 7, 2017 Author Share Posted July 7, 2017 Thank you SlackerAl. I was stuck in that loop for long. Excellent all working. Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now