vbscript - Is there a way to do non-blocking IO in VBS or a way to signal it witout a COM event? -


I have a script that comes with Windows Media Encoder. I launch it via WSH and it is STDIN, STDOUT, and STDERR.

The script starts encoding and if the encoding is encoded at the end then the encoding will check the position of the object, if the encoding knows the exit is waiting in a DO loop to have the pipe Installation (Internally loop prints just one period, and sleeps for about 2 seconds).

To exit cleanly, I would like to point out the script to stop encoding, which will allow it to drop from the loop is clear.

I do not want (or need) a COM object implemented in our app that has started the script - otherwise, I only trigger an event. (I think if it is easier than I would rethink to think to C ++)

I just thought about sending a character through STDIN to get out But the problem is that WScript.stdin has all the methods for block. Is there no way to read from Stadin or to examine the characters?

Is it possible to make a thread in VBS? As far as I can tell, you can only lauch other processes.

After

VBS has been single and you can use any non-blocker call in WScript object .

The classic VBS clause is to use as a file system object to signal asynchronous signals. Your calling process and VBScript must be agreed on the folder location that is monitored (now called c: \ temp to call it).

During the initialization, your script performs: -

  Dim FSO: set FSO = Create Object ("Scripting.FileSystem Object")  

In your code the loop is: -

  If fso.FileExists ("C: \ temp \ signal.dat") then fso.DeleteFile "c: \ temp \ signal.dat" ' // Clean and Exit Loop End If  

you are calling

its ugly but it works.

creates a file named "c: \ temp \ signal.dat" to give this script only the script instructions.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -