2 messages in com.googlegroups.google-desktop-developerRe: How to execute a external program
FromSent OnAttachments
Henry C.22 Jan 2007 19:11 
David Bloom23 Jan 2007 06:08 
Subject:Re: How to execute a external program
From:David Bloom (futu@gmail.com)
Date:01/23/2007 06:08:02 AM
List:com.googlegroups.google-desktop-developer

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?