Nas Posted August 2, 2019 Share Posted August 2, 2019 Hello guys, Is there a way to get DirCopy return code from this command : local $pid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "DirCopy(' ' ' & $sSourceFolder & ' '', ' ' ' & $sDestFolder & ' ' ') " ') Something like this but it doesn't work : local $pid = Run(@AutoItExe & ' /AutoIt3ExecuteLine " $Check = DirCopy(''' & $sSourceFolder & ''', ''' & $sDestFolder & ''')"') Thank you Earthshine 1 Link to comment Share on other sites More sharing options...
Earthshine Posted August 3, 2019 Share Posted August 3, 2019 Why not just run DirCopy by itself? My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Developers Jos Posted August 3, 2019 Developers Share Posted August 3, 2019 untested: local $rc = RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "Exit DirCopy(' ' ' & $sSourceFolder & ' '', ' ' ' & $sDestFolder & ' ' ') " ') Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Nine Posted August 3, 2019 Share Posted August 3, 2019 (edited) 5 hours ago, Earthshine said: Why not just run DirCopy by itself? I would assume he wants to show a progress bar or something similar during the copy... Here how I would do it : #include <Constants.au3> Local $sSourceFolder = "C:\Apps\Temp" Local $sDestFolder = @ScriptDir & "\Temp" Local $sCommand = ' /AutoIt3ExecuteLine "FileWriteLine (''DirCopy.log'',DirCopy(''' & $sSourceFolder & ''',''' & $sDestFolder & '''))"' Local $pid = Run(@AutoItExe & $sCommand) While ProcessExists ($pid) Sleep (100) ; show progress bar here for example WEnd Local $sStatus = FileRead ("DirCopy.log") FileDelete ("DirCopy.log") MsgBox ($MB_SYSTEMMODAL,"",$sStatus) Edited August 3, 2019 by Nine Earthshine 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nas Posted August 3, 2019 Author Share Posted August 3, 2019 (edited) 6 hours ago, Nine said: I would assume he wants to show a progress bar or something similar during the copy... Here how I would do it : #include <Constants.au3> Local $sSourceFolder = "C:\Apps\Temp" Local $sDestFolder = @ScriptDir & "\Temp" Local $sCommand = ' /AutoIt3ExecuteLine "FileWriteLine (''DirCopy.log'',DirCopy(''' & $sSourceFolder & ''',''' & $sDestFolder & '''))"' Local $pid = Run(@AutoItExe & $sCommand) While ProcessExists ($pid) Sleep (100) ; show progress bar here for example WEnd Local $sStatus = FileRead ("DirCopy.log") FileDelete ("DirCopy.log") MsgBox ($MB_SYSTEMMODAL,"",$sStatus) That's exactly what I want, my code will look like this : Local $pid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "FileWriteLine (''DirCopy.log'',DirCopy(''' & $sSourceFolder & ''',''' & $sDestFolder & '''))"') Now I can get the result and yes I am including a progress bar in there, thank you so much you're awesome. Edited August 3, 2019 by Melba23 Giant quote reduced in size considerably Link to comment Share on other sites More sharing options...
Nas Posted August 3, 2019 Author Share Posted August 3, 2019 10 hours ago, Jos said: untested: local $rc = RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "Exit DirCopy(' ' ' & $sSourceFolder & ' '', ' ' ' & $sDestFolder & ' ' ') " ') Jos This does work and gives that result of 1 or 0, but I will need that $pid process for my progress bar so this won't work for me thank you so much though. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2019 Moderators Share Posted August 3, 2019 Nas, When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. M23 Nas 1 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...
Nas Posted August 3, 2019 Author Share Posted August 3, 2019 Melba23 Ok I will next time thanks. Hi guys, I was able to come up with this script : #include <Constants.au3> Local $sSourceFolder = ".\shell32" Local $sDestFolder = ".\shell35" local $pid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "Global $Check = DirCopy(''' & $sSourceFolder & ''', ''' & $sDestFolder & '''), $Dummy = MsgBox(0,""Debug"", $Check) "') While ProcessExists ($pid) Sleep (100) WEnd MsgBox ($MB_SYSTEMMODAL,"",'Finished!!') So the Msgbox does show the return result of DirCopy but I wasn't able to get that result inside the script because it's a different process, any idea how I can recover that variable: $Check. Other than this Nine script will definitely work I am just trying to see if it can be done this way. Link to comment Share on other sites More sharing options...
Nine Posted August 3, 2019 Share Posted August 3, 2019 There is no way that this will work. Like you said it is 2 different process, you cannot pass info between them within a single line of code. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nas Posted August 5, 2019 Author Share Posted August 5, 2019 Yup that's what I thought, thanks again. 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