Jump to content

Capture and View Live Dos Output...


Recommended Posts

Hey All

I've been asked to create a script that runs a GUI for robocopy. I have everything working fine there, but I want to able to have an editbox with the details of the copy as it goes. Here is my function to start the app:

Func StartApp($source, $destination, $sub, $del, $excl, $spare)

$commandline = Chr(34) & $source & Chr(34) & " " & Chr(34) & $destination & Chr(34) & " " & $sub & $del & $excl & $spare & " /NP /TEE"

$confirm = MsgBox(1, "Please Confirm", "You are about to copy " & $source & " to " & $destination & ". Is this correct?")

If $confirm = "1" Then

$id = run("robocopy.exe " & $commandline,@scriptdir,@SW_MAXIMIZE,6)

; msgbox(0,"",$id)

While 1

$prog = stdoutread($id)

;msgbox(0,"",$prog)

$update = guictrlread($progresslog)

$prog = $update & @crlf & $prog

GUICtrlSetData($progresslog,$prog)

if @error then ExitLoop

WEnd

While 1

$prog = StderrRead($id)

;msgbox(0,"",$prog)

$update = guictrlread($progresslog)

$prog = $update & @crlf & $prog

GUICtrlSetData($progresslog,$prog)

if @error then ExitLoop

WEnd

EndIf

EndFunc ;==>StartApp

My problem lies in that when it goes to write the contents of the command prompt windows it shows only the header of the copy process, and continually flashes as though its only updating that, and not the rest of it....

Tell you what, if I haven't explained it enough there, i'll upload my script, and you just need to have robocopy.exe in the same folder as the script.

Any help would be greatly appreciated

Cheers

File_Copy.au3

Link to comment
Share on other sites

Maybe...

While 1
    $prog = StdoutRead($id)
    _GUICtrlEdit_AppendText ($progresslog, $prog)
    If @error Then ExitLoop
WEnd
While 1
    $prog = StderrRead($id)
    _GUICtrlEdit_AppendText ($progresslog, $prog)
    If @error Then ExitLoop
WEnd

You will need the BETA to do this :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...