Jump to content

Run & STDOUT not working...


hogfan
 Share

Recommended Posts

Hello, I'm working on a basic script to use the mkvmerge CLI application and it's "identify" switch (-J) to output a JSON string containing all of the property values of the file.  My generated command line appears to execute successfully, but when I try to return the string value of the captured command line output from STDOUT, the string is always empty.   Here is my code:

Func _Get_MkvProperties ()
    Local $sLogs
    ;Generate mkvmerge identify command (outputs all MKV properties as JSON)
    Local $GetMkvProps = '"' & $myMkvToolNixPath & "\mkvmerge.exe" & '"' & " -J" & ' "' & $myFullSourceFilePath & '"'
    ;show the generated command
    Msgbox(64,"", $GetMkvProps)

    Local $iPID = Run($GetMkvProps,"",@SW_HIDE, $STDOUT_CHILD)
    
        ;Capture output from the Run command as a string
            While 1
                $sLogs = $sLogs & @CRLF & StdoutRead($iPID)
        If @error Then ExitLoop ; Exit the loop if the process closes or StdoutRead returns an error.
            WEnd

    Msgbox(64, "", $sLogs)

EndFunc

Any insight into my error is appreciated.   Once I have captured the JSON output in the $sLogs string, my next step will be to parse the JSON to extract each of the properties as a variable.

Link to comment
Share on other sites

  • 1 year later...

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