Is there any way to run a program silently from a gadget and collect its output
The only way I know of for running a porgram is System.Shell.execute, but this flashes the cmd window quickly (this is a CLI exe) and I don't see a way to get the output of the program.
I am currently accomplishing the same thing by using Wscript and objShell.Run, sending the output to a text file, and then reading the text file. Just wondering if there is a better way.
Does jscript allow you to launch a program silently

Silently running an external program from a gadget
robinjam
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run(System.Gadget.path + "\\qstat.exe -xml yourcommands > " + System.Gadget.path +"\\qstat.xml",0 true);
then all you have to do is read the xml for your data
Sam_2
Chris McLeod
This unfortunately pops up the cmd window momentarily, just like System.Shell.execute
yosonu
DrJim
How would that work say i have a .net app it would be like
class Test{
[
STAThread]public static void Main()
{
// main must return void
}
}
I have a small .net app which i want to return a string when certain event fire, can i use that in a gadget if so how
Akshay Saini
Mauricio Castillo E
are you trying to run a .net app and read the output
if so set the project output type to windows application and no window will open
Maxim Masiutin
Try this
var WshShell = new ActiveXObject("WScript.Shell");
var exec = WshShell.Exec(System.Gadget.path + "\\myapp.exe");
var outputData = exec.StdOut.ReadAll();
i hope this helps