MrDoge wrote:
I think the output needs to be duplicated ?
You can't "duplicate" the output the way you are thinking of. That is not how it works. You either need to scrape the console with ReadConsoleOutputCharacter (and not redirect anything), or you need to decide what parts you want to redirect, or you can use a combo if you wish. You could allow stdout to redirect, while keeping stderr in the console window. If I remember correctly this is what you were trying to do.
If you choose to use ReadConsoleOutputCharacter to scrape, it can be tricky. If you keep the console buffer the default size (80 cols x 9000 lines - ish?) it won't perform well. And if you resize the buffer too small you might miss data. So scraping is really not ideal at all.
From the OP:
Code: Select all
, NumPut(hPipeW, SI, P8 ? 88 : 60) ; hStdOutput
, NumPut(hPipeW, SI, P8 ? 96 : 64) ; hStdError <------------------- comment this out, to start with
That should be part of your next step for testing. This way you can still capture stdout, and then stderr will remain in the console. The problem however, is that you will have no way of matching stderr with a specific command. So you will just have a dump of errors with little or no way to tell what the full command actually was.
At least with everything being directed, you can still sort out the output and decide what is what.
Your ECHO commands can have a special sequence added (before, after, both) so that you can tell the difference between an echo and an error. For example:
But honestly though, fabricating an ECHO to look like an error, what purpose does that serve anyway? If you properly format an ECHO then it should be easy to tell what is an error, ECHO, or normal program output.
EDIT: If you want to duplicate the output (ie. with
tee) you certainly can, but what you are trying to do sounds like it can happen all in AHK with the proper mindset. Sometimes ya might just be approaching a problem all wrong and come up with some wacky solutions. And as for C++ that is definitely not necessary in this case. I pointed you to that for use with DllCall(), not to start programming. SKAN uses CreateProcess in his func.