I have a variation of a script that comes with Windows Media Encoder. I launch it via WSH and set up pipes to it's STDIN, STDOUT, and STDERR.
The script starts encoding and eventually waits in a DO loop checking the encoding object's status so the script knows to exit if encoding stops. (internally the loop just prints a period, and sleeps for about 2 sec).
To cleanly exit, I'd like to signal the script to stop encoding, which will allow it to drop from the loop and clean up.
I don't (or necessarily want to) have a COM object implemented in our app which launched the script - otherwise, I'd just trigger an event. (I'll reconsider if that's easier than I think to do in C++)
I thought of just sending it a character via STDIN to exit, but the problem is that all of the methods for WScript.stdin block. Is there any non-blocking way to read from stdin or some way to check for characters?
Is it possible to do a thread in VBS? as far as I can tell, you can only lauch other processes.