hogfan Posted December 5, 2021 Share Posted December 5, 2021 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 More sharing options...
mikell Posted December 6, 2021 Share Posted December 6, 2021 (edited) Please try Local $iPID = Run($GetMkvProps, "", @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sLogs = StdoutRead($iPID) Msgbox(64, "", $sLogs) Edited December 6, 2021 by mikell Link to comment Share on other sites More sharing options...
tbodine88 Posted December 10, 2022 Share Posted December 10, 2022 Mikell That didn't work. The popup is empty tbodine Link to comment Share on other sites More sharing options...
Nine Posted December 10, 2022 Share Posted December 10, 2022 Maybe you need to provide the working directory ? Otherwise, add extensive error handling and post Scite console along with the script. “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...
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