niteshade Posted May 13, 2009 Posted May 13, 2009 (edited) Having problems with this, despite searching through the forums I read in one of the threads to use FileCopy resursively. How, I have no clue. I'm putting my code up, so one of you advanced beings can nudge me into the right direction #include <File.au3> $UserSettingsFile = "UserSettings.ini" $Source = IniRead($UserSettingsFile,"Paths","SourcePath","Path Not Found") ;COPY SOURCE FROM DVD $DVDSource = FileSelectFolder("Browse For DVD Root","",1,"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}","SecondPage") If @error Then MsgBox(4096,"","No DVD Root Chosen") Else ;BASICALLY ALL FOR A PROGRESS BAR $FILE = _FileListToArray($DVDSource) ProgressOn("","Copying",$DVDSource & " to " & $Source) For $INDEX = 1 To $FILE[0] FileCopy($DVDSource & "\" & $FILE[$INDEX],$Source & "\" & $FILE[$INDEX],9) ProgressSet($INDEX*100/Number($FILE[0]),$DVDSource & "\" & $FILE[$INDEX] & " to " & @CRLF & $Source & "\" & $FILE[$INDEX]) Next ProgressOff() FileCopy( ;DirCopy($DVDSource,$Source,1) EndIf Trouble is, it ends right after it asks for the $DVDSource - gives an error on the FileCopy line. Error parsing function call, it says. Thanks in advance Oh, also, I forgot to mention, the $DVDSource will definitely have more than one folder, which will need to be copied over. Edited May 13, 2009 by niteshade
rajeshontheweb Posted May 13, 2009 Posted May 13, 2009 it should be FileCopy($DVDSource & "\" & $FILE[$INDEX],$Source & "\" & $FILE[$INDEX],8) if u want to create directory structure in destination. not 9. better use scite4autoit. thats easier to use. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
niteshade Posted May 13, 2009 Author Posted May 13, 2009 (edited) it should be FileCopy($DVDSource & "\" & $FILE[$INDEX],$Source & "\" & $FILE[$INDEX],8) if u want to create directory structure in destination. not 9. better use scite4autoit. thats easier to use. I am using it. And it still doesn't work. The progress bar pops up for a split second, then it gives an error - which I believe is when the $FILE array with a folder name is loaded, seeing as there are two empty files that copy over with the name of the folders on the actual source. I'm using FileCopy as shown here because of the examples I saw when I was searching the forum. I can get the entire thing to copy using DirCopy, but I don't know how to make a progress bar out of it. Edited May 13, 2009 by niteshade
rajeshontheweb Posted May 13, 2009 Posted May 13, 2009 expandcollapse popup#include <File.au3> $UserSettingsFile = "UserSettings.ini" $Source = IniRead($UserSettingsFile,"Paths","SourcePath","Path Not Found") ;COPY SOURCE FROM DVD $DVDSource = FileSelectFolder("Browse For DVD Root","",1,"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}","SecondPage") If @error Then MsgBox(4096,"","No DVD Root Chosen") Else ;BASICALLY ALL FOR A PROGRESS BAR $FILE = _FileListToArray($DVDSource) If IsArray($FILE) then ProgressOn("","Copying",$DVDSource & " to " & $Source) For $INDEX = 1 To $FILE[0] _CopyFromDisc($INDEX) ; 9 overwrites if files exist which we may not need here. ProgressSet($INDEX*100/Number($FILE[0]),$DVDSource & "\" & $FILE[$INDEX] & " to " & @CRLF & $Source & "\" & $FILE[$INDEX]) Next Msgbox(0,"","completed") ProgressOff() Else Msgbox(0,"", "Nothing Found copiable!") EndIf ;DirCopy($DVDSource,$Source,1) EndIf Func _CopyFromDisc($i) $ret = FileCopy($DVDSource & "\" & $FILE[$i], $Source & "\" & $FILE[$i] , 9) ; 9 overwrites if files exist which we may not need here. If $ret = 1 then $ret = " Copied successfully" Else $ret = " Operation Failed" EndIf ConsoleWrite( @CRLF & $i & " " & @TAB & "Copying : " & $FILE[$i] & $ret ) EndFunc this works perfectly for me, just in this case i have added _CopyFromDisc to let u see the output thats all. when u get this working just replace that line with what u had earlier, it would work. the basic thing is that i am checking if there are any files available for copying or else, it will just notify user, instead of throwing an error. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
niteshade Posted May 13, 2009 Author Posted May 13, 2009 Still not working.... does exactly the same thing as when I did it on my own, copies about 4 files over, then quits - without any error though, and still doesn't copy over any directories. Thanks anyway
rajeshontheweb Posted May 13, 2009 Posted May 13, 2009 what is it are you able to see in the console window? i wonder if it was due to bad media or something similar? autoit3.exe might have crashed and quit ? that is a possibility. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
niteshade Posted May 14, 2009 Author Posted May 14, 2009 what is it are you able to see in the console window? i wonder if it was due to bad media or something similar? autoit3.exe might have crashed and quit ? that is a possibility. Well I don't see anything at all in the console window. I don't think its bad media - I'm using a mounted ISO, and it works fine. Here's a bit of code that I edited, seems to do the job halfway ;COPY SOURCE FROM DVD $DVDSource = FileSelectFolder("Browse For DVD Root","",1,"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}","SecondPage") If @error Then MsgBox(4096,"","No DVD Root Chosen") Else ;BASICALLY ALL FOR A PROGRESS BAR $FILE = _FileListToArray($DVDSource) ProgressOn("Copying Files","Copying",$DVDSource & " to " & $Source) For $INDEX = 1 To $FILE[0] DirCopy ($DVDSource & "\" & $FILE[$INDEX],$Source & "\" & $FILE[$INDEX],1) FileCopy($DVDSource & "\" & $FILE[$INDEX],$Source & "\" & $FILE[$INDEX],8) ProgressSet($INDEX*100/Number($FILE[0]),$DVDSource & "\" & $FILE[$INDEX] & " to " & @CRLF & $Source & "\" & $FILE[$INDEX]) Next ProgressOff() EndIf
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