Sorry I'm new to this, and having got hold of some of the basics and played with some examples I still can't figure this one out.
What I want to do via a GUI is for the user to select a folder and for that folder to be displayed in an input box so there is a visual on screen of the folder location.
Later on in the script, (still writting all of it as solving each section a bit at a time) this input will be used as the Source and Destination folders.
I decided on the FileSelectFolder as it was the most straightforward way of solving drive and network locations across multiple machine.
Code so far
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
Opt("GUIOnEventMode", 1)
;Global &Source, &Destination
Global $Source
Global $FileSelectFolder1
Global $FileSelectFolder
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Copy Folder", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Copy = GUICtrlCreateButton("Copy", 184, 208, 161, 49)
GUICtrlSetOnEvent(-1, "CopyClick")
$SourceButton = GUICtrlCreateButton("SourceButton", 48, 40, 137, 41)
GUICtrlSetOnEvent(-1, "SourceButtonClick")
$DestButton = GUICtrlCreateButton("DestButton", 48, 104, 137, 41)
GUICtrlSetOnEvent(-1, "DestButtonClick")
$Progress1 = GUICtrlCreateProgress(104, 320, 425, 49)
$Source = GUICtrlCreateInput("Source", 240, 48, 321, 21)
GUICtrlSetOnEvent(-1, "SourceChange")
$Destination = GUICtrlCreateInput("Destination", 240, 120, 305, 21)
GUICtrlSetOnEvent(-1, "DestinationChange")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func CopyClick()
EndFunc
Func DestButtonClick()
Local Const $sMessage = "Select a folder"
; Display an open dialog to select a file.
Local $sFileSelectFolder1 = FileSelectFolder($sMessage, "")
If @error Then
; Display the error message.
MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
Else
; Display the selected folder.
MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder1)
EndIf
EndFunc
Func DestinationChange()
EndFunc
Func Form1Close()
EndFunc
Func Form1Maximize()
EndFunc
Func Form1Minimize()
EndFunc
Func Form1Restore()
EndFunc
Func SourceButtonClick()
Local Const $sMessage = "Select a folder"
; Display an open dialog to select a file.
Local $sFileSelectFolder = FileSelectFolder($sMessage, "")
If @error Then
; Display the error message.
MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
Else
; Display the selected folder.
MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
EndIf
EndFunc ;==>Example)
Func SourceChange()
EndFunc
Func Source()
EndFunc