mobster Posted January 5, 2011 Share Posted January 5, 2011 Hi I am looking for a function that will be able to copy multiple files but the file selction must be done with with the following function : FileOpenDialog($message, @WindowsDir & "", "All Files (*.*)", 4 + 8 ), I was having problems transfering all files from the function result to an array . please see if you can help , I have tried to use this code . ThanksMfilecopy.au3 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 5, 2011 Moderators Share Posted January 5, 2011 mobster, Welcome to the AutoIt forum. I think you are overcomplicating things a bit - take a look at this to see how to get the selected files into an array: #include <Array.au3> ; Just to display the result $message = "Hold down Ctrl or Shift to choose multiple files." $var = FileOpenDialog($message, @ScriptDir & "", "All Files (*.*)", 4 + 8 ) $FileList = StringSplit($var, "|") ; Check the Help file to see how the result is returned _ArrayDisplay($FileList) It should be pretty easy to copy your selected files to wherever you need by looping through the array. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mobster Posted January 8, 2011 Author Share Posted January 8, 2011 mobster, Welcome to the AutoIt forum. I think you are overcomplicating things a bit - take a look at this to see how to get the selected files into an array: #include <Array.au3> ; Just to display the result $message = "Hold down Ctrl or Shift to choose multiple files." $var = FileOpenDialog($message, @ScriptDir & "", "All Files (*.*)", 4 + 8 ) $FileList = StringSplit($var, "|") ; Check the Help file to see how the result is returned _ArrayDisplay($FileList) It should be pretty easy to copy your selected files to wherever you need by looping through the array. M23 Hi M23 Thanks for your help :-) I am still stuck on this one can you please show me what you ment "It should be pretty easy to copy your selected files to wherever you need by looping through the array " Thanks a lot Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 8, 2011 Share Posted January 8, 2011 Don't Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 9, 2011 Moderators Share Posted January 9, 2011 mobster,Do you understand arrays? If not, then a read of the Arrays tutorial in the Wiki would be a good idea before we go any further.Let me know IN THIS THREAD when you are ready to move on. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mobster Posted January 10, 2011 Author Share Posted January 10, 2011 Don't How would you add a progress bar to this function ? , I was able to add a progress bar to the single file copy but not to the multiple files copy.Can you please help ?Thanksarrayfinal3.au3 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2011 Moderators Share Posted January 10, 2011 mobster, I would suggest that you take the simple approach and increment a progress bar for each file copied regardless of size or time taken. So you could do something like this: expandcollapse popup; Simulate the selection process Global $aSelections[12] = [11, "Folder"] For $i = 2 To 11 $aSelections[$i] = "File " & $i - 1 Next _multifile() Func _multifile() ; Create a progress bar ProgressOn ( "File copying", "Your files are being copied") ; Set the percentage and increment values $iPercent = 0 $iIncrement = 100 / ($aSelections[0] - 1) ; Now copy the files For $i = 2 To UBound($aSelections) - 1 ; Create the file name $sFile = $aSelections[1] & "\" & $aSelections[$i] ; Determine current percentage $iPercent += $iIncrement ; Set the progress to show how and what we are doing ProgressSet($iPercent, "Copying " & $sFile) ; You would do the file copy here - you may want to add a short sleep just so the progress moves enough to be in sync Sleep(1000) Next ; Annonce all done ProgressSet(100, " ", "All files copied") Sleep(1000) ; Clear the progress ProgressOff() EndFunc ;==>_multifile Will that do? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mobster Posted January 10, 2011 Author Share Posted January 10, 2011 Thank you so much M23 appreciate all your help ,the code is working perfectly Link to comment Share on other sites More sharing options...
mobster Posted January 11, 2011 Author Share Posted January 11, 2011 mobster, I would suggest that you take the simple approach and increment a progress bar for each file copied regardless of size or time taken. So you could do something like this: expandcollapse popup; Simulate the selection process Global $aSelections[12] = [11, "Folder"] For $i = 2 To 11 $aSelections[$i] = "File " & $i - 1 Next _multifile() Func _multifile() ; Create a progress bar ProgressOn ( "File copying", "Your files are being copied") ; Set the percentage and increment values $iPercent = 0 $iIncrement = 100 / ($aSelections[0] - 1) ; Now copy the files For $i = 2 To UBound($aSelections) - 1 ; Create the file name $sFile = $aSelections[1] & "\" & $aSelections[$i] ; Determine current percentage $iPercent += $iIncrement ; Set the progress to show how and what we are doing ProgressSet($iPercent, "Copying " & $sFile) ; You would do the file copy here - you may want to add a short sleep just so the progress moves enough to be in sync Sleep(1000) Next ; Annonce all done ProgressSet(100, " ", "All files copied") Sleep(1000) ; Clear the progress ProgressOff() EndFunc ;==>_multifile Will that do? M23 Hi Sorry to bug you again but can you please show me how would the same thing done for a copy of a single file and a progress bar Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2011 Moderators Share Posted January 11, 2011 mobster, For a single file you would ideally need a progress which actually reflects the time taken. There are many scripts on the forum which show how to do that. Or you could go the simple route and just use a marquee progress to indicate that something was happening: #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateProgress(10, 10, 400, 20, $PBS_MARQUEE) GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mobster Posted January 12, 2011 Author Share Posted January 12, 2011 Hi Since I am using 2 progress bars in my script I would like them to look the same so I would like to have a progress bar like the first one you wrote for me . I also need to show some calculation and I think it would be nice to show the file name with the progress rate. I have searched the forum and didn't find any thing like it . Can you assit ? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2011 Moderators Share Posted January 12, 2011 mobster,Less than 30 seconds of searching for "+file +copy +progress +multiple" threw up this UDF from Yashied. It came second in the Search results to this thread - someone's search skills obviously need a bit of sharpening. Yashied's UDF seems to do everything you want - and you get the same interface whether you are copying single or multiple files. Over to you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mobster Posted January 12, 2011 Author Share Posted January 12, 2011 mobster, Less than 30 seconds of searching for "+file +copy +progress +multiple" threw up this UDF from Yashied. It came second in the Search results to this thread - someone's search skills obviously need a bit of sharpening. Yashied's UDF seems to do everything you want - and you get the same interface whether you are copying single or multiple files. Over to you. M23 Thanks How do I add the additional files (UDF) to autoit Environment ? Which files do I need ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2011 Moderators Share Posted January 12, 2011 mobster, Download the zip file from Yashied's topic and unzip the files into the same folder as your script. You then add the following line to the top of your script: #include "Copy.au3" The functions within the UDF are now available within your script. Note that you also need a dll file from the zip as well as the .au3 file for the UDF to function. There is an example in the zip - I strongly recommend you play with it a while to see how the whole thing works. I have never used so I cannot offer much more advice than that. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
guinness Posted January 12, 2011 Share Posted January 12, 2011 The Copy UDF is pretty good and so easy to use UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
mobster Posted January 16, 2011 Author Share Posted January 16, 2011 mobster, Download the zip file from Yashied's topic and unzip the files into the same folder as your script. You then add the following line to the top of your script: #include "Copy.au3" The functions within the UDF are now available within your script. Note that you also need a dll file from the zip as well as the .au3 file for the UDF to function. There is an example in the zip - I strongly recommend you play with it a while to see how the whole thing works. I have never used so I cannot offer much more advice than that. M23 Hi there The last code you sent me didnt work ,do you have a simple code for a single file copy and a progress bar which run's according to the file size ? Thanks 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