Jump to content

Recommended Posts

Posted (edited)

Hi, 

I'm doing an automation that will access command prompt tool (Git). I want to clone a project file from Git.
I can get the standard output from cmd (such as ping etc), but I can't get the process output happened in Git.
Is there a reason why I can't grab the text?
 

Global $cmdhWnd=Run(@ComSpec & " /k","", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

$ip="127.0.0.1"
StdinWrite($cmdhWnd,"ping "&$ip&@CRLF)
read()

Func read()
    While 1
        $sRecv = StdoutRead($cmdhWnd, False, False)
        While 1
            Sleep(200)
            $RecvBuffer = StdoutRead($cmdhWnd, False, False)
            If $RecvBuffer = "" Then
                ExitLoop
            EndIf
            $sRecv &= $RecvBuffer; append new data to $Recv

        WEnd
        If $sRecv <> "" Then ; Got response, return it to caller
            MsgBox(1,"",$sRecv)
            Return $sRecv
        EndIf
    WEnd
EndFunc

 

Edited by eibwen

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
×
×
  • Create New...