12-19-2021 11:59 PM
Hi,
I am using JKI .NET exec palette to run some batch files and commands. I need to monitor the stdout of the the scripts, however I need to clear the console stdout at certain places without having to close the console.
Can anyone help me with some methods to do so?
12-20-2021 02:05 AM
You can’t. The stdout is controlled by the program you execute not you as a caller. What do you try to do?
12-20-2021 02:28 AM
Since the data for the STDOUT is coming through event, and is basically concatenating the string (as I have seen in the examples). You can set a programmatic event where you can clear the data from certain places (Remove Lines from the string - STDOUT).
12-20-2021 04:20 AM
To provide a clearer picture of what I am doing,
I am using an Event Driven State Machine which performs the following operations:
1. opens the console
2. runs a command to check connection with the hardware.
3. Waits for user event
4. Executes a batch file which runs a script when user event is received.
5. After the completion of the script a string pattern is matched with the stdout result to update a boolean Pass/Fail indicator.
6. After updating the Pass/Fail indicator, the console waits for the next user event without closing the console and the cycle is repeated from point 3 are repeated until the VI is closed.
In windows Cmd "cls" command clears the console.
However I am not sure sending "cls" command to JKI .NET exec has any effect on the stdout.
12-20-2021 04:41 AM
@linu95k wrote:
In windows Cmd "cls" command clears the console.
However I am not sure sending "cls" command to JKI .NET exec has any effect on the stdout.
It doesn't but why do you care? You receive the string from the command line and determine which part of the received string you keep and which you throw away. Even if your command line program would issue a cls command all you would see is a single non printable character in the stdout stream correspending to the command to clear the screen. But since your command line is now connected to streams that you control and not the cmd.exe window it will not cause anything more than a strange character in the received string.
Those standard IO interfaces are simply stream interfaces over which bytes are transferred. If at some point you want to clear whatever you have received so far you need to clear that buffer where you keep your received bytes.