Jump to content
Sign in to follow this  
Nas

AutoItExe Return Error.

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.
  :)

Share this post


Link to post
Share on other sites
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 by Nine

Share this post


Link to post
Share on other sites
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 by Melba23
Giant quote reduced in size considerably

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

 


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...