TimTheGuy Posted July 8 Share Posted July 8 I have a .exe process that spits out TEXT data to console with line feeds. It will take days to complete and will produce a TB of output if I used "> OUTPUT.LOG" I want it all BUT I do not want a TB+ file. My idea was to write a simple program that will take a few seconds of data and write to disk. However, the data comes out in lines and with this much data, I want to keep the lines complete(not broken across files). The problem: ConsoleRead() does not block, it will return immediately. In order to get all data, it must be called in a loop. $BUFFER_INPUT = CONSOLEREAD() I can't get a stable data read from ConsoleRead()! It seems that the value of $BUFFER_INPUT changes through the program. I only expected it to change when the CONSOLEREAD() was issued. Please help if you know a better way! SplitForum.au3 Link to comment Share on other sites More sharing options...
Nine Posted July 9 Share Posted July 9 When you post code, please use the method shown in the link. As for your script, use tidy (ctrl-t) in Scite, that will make it easier for us to read it (all upper case is not a best programming practice). As for your issue, it is very hard to help you since we are missing one big part of your system (the program that splits text). And it is not clear how you get to read the stdin stream. Is it thru piping ? In any case, you do not manage @error after ConsoleRead, that certainly a must if you want to understand what is going on. Another possible issue is that you are not reading the stream fast enough (with all the sleeps you got in your script). Crystal ball has pretty much gone as far as it could... “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...
rudi Posted July 12 Share Posted July 12 Hello, welcome to the forum. This script is starting your program with the optional paramter $STDERR_MERGED, so that stderr and stdout will be available by using StdOutRead. Simply loop as long as the process exist to "catch" all output, then process this output as needed. $YourExe="C:\path\YourProgram.exe" $PID = Run($YourEXE, @TempDir, @SW_HIDE, $STDERR_MERGED) $StrOutput="" while ProcessExists($PID) $StrOutput &= StdoutRead($PID) ; process the output as you need, remove processed lines so it will not grow to 3TB Sleep(1000) WEnd MsgBox(0, "", "Done") CU, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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