Henry:
Here is an example of how to launch Notepad.
// begin example
var shell = new ActiveXObject("WScript.Shell");
var process=shell.Exec("notepad");
// ----- The code below this line is optional: -----
var watchProcess=function(process) {
if (process.Status==0) {
setTimeout(function(){watchProcess(process)},100);
} else {
// The code here will run once the program is quit
// or finishes running.
gadget.debug.trace("This program is done running");
}
};
watchProcess(process);
// end example
Note that I don't use the full path to Notepad - this is because
shell.Exec works just like the "Run" command in the Start menu, which
"expands" some paths automatically (in this case, "notepad" usually
expands to "%WINDIR%\system32\notepad.exe").
You also can specify a file using shell.Exec, or even an Internet
address, and Windows will open it using the default program.
On Jan 22, 9:12 pm, "Henry C." <huoc...@gmail.com> wrote:
I want to create a gadget that can run extermal program, such as
notepad. How can I do it?