DigDeep Posted December 22, 2015 Posted December 22, 2015 (edited) When I am am selecting Add button, the Browse window opens up. I have given up the Input Box so that any file path when selected would be showing up in the Input Box. Something as shown in the below Pic.Can someone please help here...expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #Region $Form = GUICreate("Form", 688, 125, 635, 317) $Find = GUICtrlCreateInput("", 40, 56, 457, 24) $ADD = GUICtrlCreateButton("ADD", 520, 56, 115, 25) GUISetState(@SW_SHOW) #EndRegion While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ADD GUICtrlSetData($Find, Browse()) EndSwitch WEnd Func Browse() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $Message = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $Browse = FileOpenDialog($Message, @WindowsDir & "\", "All Files (*.*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $Browse = StringReplace($Browse, "|", @CRLF) MsgBox(0, "", $Browse) EndIf EndFunc ;==>Browse Edited December 22, 2015 by DigDeep
kylomas Posted December 23, 2015 Posted December 23, 2015 (edited) DigDeep,Just return the value from the function call...expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #Region $Form = GUICreate("Form", 688, 125, 635, 317) $Find = GUICtrlCreateInput("", 40, 56, 457, 24) $ADD = GUICtrlCreateButton("ADD", 520, 56, 115, 25) GUISetState(@SW_SHOW) #EndRegion While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ADD GUICtrlSetData($Find, Browse()) EndSwitch WEnd Func Browse() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $Message = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $Browse = FileOpenDialog($Message, @WindowsDir & "\", "All Files (*.*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $Browse = StringReplace($Browse, "|", @CRLF) ConsoleWrite($Browse & @CRLF) return $browse ; <---------------------------------------- ;MsgBox(0, "", $Browse) EndIf EndFunc ;==>Browsekylomasedit: if you want to return multiple files you should use a list or listview Edited December 23, 2015 by kylomas additional data Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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