Jump to content

richsimple

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by richsimple

  1. Thanks, was trying to find this type of postbefore I posted.
  2. I have come a blank with this one and every option I have tried so far hasn't worked. Im using a simple GUI using FileSelectFolder to copy files from USB to any other drive, what I would like to do is get the progree bar working but I don't have a clue where to start. This is the copy code I'm using and it does what I need it to do, I would just like to see how far through it is as some files are large and if its on USB I don't want to be pulling out the stick before its finished Func CopyClick() Local $source = $sFileSelectFolder Local $dest = $sFileSelectFolder1 Local $dest_time = $sFileSelectFolder & "\\..\old" & @YEAR & "-" & @MON & "-" & @MDAY If FileExists($dest_time) Then Local $num = 1 Local $new_dest = FileExists($dest_time & " " & $num) While 1 If $new_dest Then $num = $num + 1 $new_dest = FileExists($dest_time & " " & $num) Else DirMove($dest, $dest_time & " " & $num) ExitLoop EndIf WEnd Else DirMove($dest, $dest_time) EndIf DirCopy($source, $dest) ;@WorkingDir EndFunc ;==>CopyClick I know the solution is simple yet it escapes me...
  3. Thanks for the help on this, The input box is now doing what I want it to do, so I'm going to move on with the script.
  4. Sorry about the lack of tags... but thanks for the GUICtrlSetData I did see this earlier but couldn't workout where to put it.
  5. 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
×
×
  • Create New...