It was hard to find in the public domain, but not on GitHub, so I uploaded it.
ProcessOutputMonitor
can spawns a child process and monitors the output.
.PID
- Return child process Process ID
.
.IsRunning
- Checks the child process status. Returns boolean.
.NextLine
- Return output per line
.NextData
- Return new output
Dim monitorGoogle
Set monitorGoogle = New ProcessOutputMonitor
monitorGoogle.Start "cmd.exe /c ping -4 www.google.com"
timerID = window.setInterval(GetRef("monitorPings"), 500)
Dim buffer, keepRunning
keepRunning = False
buffer = monitorGoogle.NextData
If Not IsEmpty( buffer ) Then
' This will run if the child process shows output at cmd
' Put your codes here
keepRunning = True
Else
' This will run if the child process is still running and output is empty
' Put your codes here
keepRunning = CBool( keepRunning Or monitorGoogle.IsRunning )
End If
If Not keepRunning Then
window.clearInterval( timerID )
timerID = Empty
' This will run once the child process has stopped running
' Put your codes here
End If