Gringo Posted February 25, 2018 Posted February 25, 2018 Hi, I'd like to do simple copy of a directory reading an ini for the path. I'm pretty sure it's not a big deal but for a noob like me... Well I'm looking for a solution since 2 hours now #include <MsgBoxConstants.au3> $dircp = IniRead("path.ini", "Path", "path", " ERROR") MsgBox($MB_SYSTEMMODAL, "", "path is: : " & $dircp) DirCopy ("Guideone", $dircp) The value returned by iniread is correct, but the dircopy does nothing, Any idea?
Subz Posted February 25, 2018 Posted February 25, 2018 After DirCopy add a MsgBox with @error to determine the error. Also try to use pathname @ScriptDir & "\GuideOne" for your first parameter (assuming "GuideOne" is in the same folder as the script.
Gringo Posted February 25, 2018 Author Posted February 25, 2018 (edited) Thank you for your answer, I'll try that but the synthax with the & $dircp seems correct right? Edited February 25, 2018 by Gringo
Subz Posted February 25, 2018 Posted February 25, 2018 Syntax looks correct, normally I would write the script like so, it's basically the same as your script except with some error handling, hope it makes sense. Local $sSrcPath = @ScriptDir & "\Guideone" If FileExists($sSrcPath) = 0 Then Exit MsgBox(16, "Error", "Source File: " & $sSrcPath & " doe's not exist.") Local $sTgtPath = IniRead(@ScriptDir & "\Path.ini", "Path", "Path", "Error") If $sTgtPath = "Error" Then Exit MsgBox(16, "Error", "Error Reading Ini.") Local $hDirCopy = DirCopy ($sSrcPath, $sTgtPath, 1) ;~ Flag 1 means overwrite existing folder If $hDirCopy = 1 Then MsgBox(64, "Success", "Copied:" & @CRLF & @TAB & $sSrcPath & @CRLF & " To: " & @CRLF & @TAB & $sTgtPath) Else MsgBox(16, "Failure", "Error Copying:" & @CRLF & @TAB & $sSrcPath & @CRLF & " To: " & @CRLF & @TAB & $sTgtPath) EndIf
Gringo Posted February 26, 2018 Author Posted February 26, 2018 (edited) Thank you very much again, It says that the folder is copied exept it doesn't, maybe It's a bug with dircopy I tried to compile it and run it as administrator with no success. Maybe I can try to do the same thing runing a command like xcopy guideone "F:\Jeux\Steam\SteamApps\common\Fallout 4\guideone" /s /y /I but passing the destination dir as variable something like #include <MsgBoxConstants.au3> $dircp = IniRead("path.ini", "Path", "path", " ERROR") Run(@ComSpec & " /c " & "xcopy ", & "guideone " &$dircp & " /s" " /y" " /I", "", @SW_HIDE) I'll test that, what do you think? Edited February 26, 2018 by Gringo
Moderators Melba23 Posted February 26, 2018 Moderators Posted February 26, 2018 Gringo, You appear not to have read the Forum rules since your arrival. Please do read them - particularly the bit about not discussing game interaction - before you post again and then you will understand why you will get no help and this thread will now be locked. 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
Recommended Posts