Olaf Doschke
Programmer
It's very easy to start an exe and communicate with it via stdin/stdout, by using Wscript.Shell:
A simple example with cmd.exe and dir output:
StdIn and StdOut are the standard pipes you might remember from DOS times you could pipe stdout to the next process with | or redirect it with >, eg to a file or device.
The called exe will of unfortunately also show up, unless it's windowless. If you have that under your control, eg you are the developer of the exe, that's up to you. In this case you can use this as communication without files. What's missing is an event occurring when the called exe returns something via it's stdout or stderr pipe (or both), but it's good for situations not taking long. You can also keep the executed process running (like a service, but without the headache of creating a real service or setting up SrvAny) and send in commands when needed and receive the answers. It's up to you to define a communication protocol as you like.
Bye, Olaf.
Code:
oWSH = CreateObject("Wscript.Shell")
oExec = oWSH.Exec("C:\somedir\someapp.exe")
oExec.StdIn.WriteLine("Send in Value/Command")
oExec.StdOut.ReadLine() && or Read() or ReadAll()
A simple example with cmd.exe and dir output:
Code:
oWSH = CreateObject("Wscript.Shell")
CD (Home())
oExec = oWSH.Exec("cmd.exe /c dir")
? oExec.StdOut.ReadAll()
StdIn and StdOut are the standard pipes you might remember from DOS times you could pipe stdout to the next process with | or redirect it with >, eg to a file or device.
The called exe will of unfortunately also show up, unless it's windowless. If you have that under your control, eg you are the developer of the exe, that's up to you. In this case you can use this as communication without files. What's missing is an event occurring when the called exe returns something via it's stdout or stderr pipe (or both), but it's good for situations not taking long. You can also keep the executed process running (like a service, but without the headache of creating a real service or setting up SrvAny) and send in commands when needed and receive the answers. It's up to you to define a communication protocol as you like.
Bye, Olaf.