nadasurf2

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



Re: Sidebar Gadget Development Silently running an external program from a gadget

Tom from cener.co.uk

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





Re: Sidebar Gadget Development Silently running an external program from a gadget

nadasurf2

This unfortunately pops up the cmd window momentarily, just like System.Shell.execute





Re: Sidebar Gadget Development Silently running an external program from a gadget

Tom from cener.co.uk

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





Re: Sidebar Gadget Development Silently running an external program from a gadget

nadasurf2

no it's a command line exe. i didn't write it and I don't know what it was written in. it's called qstat and it lets you enter a game server name and returns the number of current players, map name, server name, and so on.



Re: Sidebar Gadget Development Silently running an external program from a gadget

Tom from cener.co.uk

right the only way i think you can do it is to read a xml file

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




Re: Sidebar Gadget Development Silently running an external program from a gadget

nadasurf2

yea that is what im doing now, except to a txt file. oh well, at least it works. thanks guys



Re: Sidebar Gadget Development Silently running an external program from a gadget

Alexanderk_20

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





Re: Sidebar Gadget Development Silently running an external program from a gadget

KDragon75

I am trying somthing similer but when running in the sidebar nothing happens. When run in IE7 i get an error somthing like the "Automation server can't crate the object". Is this a problom on my box or what