[Javascript] How to open notepad.exe

Ganesh Kamath kamath_ti at rediffmail.com
Sun Jun 15 18:06:33 CDT 2003


Hi,

I would like to open "notepad.exe" from web brower to interface with some web application. I 
tried to use Javascipt as web brower language. I tried following piece of code, but 
I always get  "ActiveXObject is not defined." error.

Can somebody help me to resolve this.

<HTML>
<HEAD>

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
  function executeCommands(inputparms)
   {
    var oShell = new ActiveXObject("Shell.Application");
    var commandtoRun = "C:\\Winnt\\Notepad.exe";
    if (inputparms != "")
     {
      var commandParms = document.Form1.filename.value;
     }

     oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
  }
</SCRIPT>

</HEAD>
<BODY>
<FORM name="Form1">
<CENTER>
<BR><BR>
<H1>Execute PC Commands From HTML </H1>
<BR><BR> 
<File Name to Open:> <Input type="text" 
   name="filename"/>
<BR><BR>

<input type="Button" name="Button1" 
   value="Run Notepad.exe" onClick="executeCommands()" />

<BR><BR>
<Input type="Button" name="Button2" 
   value="Run Notepad.exe with Parameters" />
</CENTER>
</BODY>
</FORM>
</HTML>

Thanks and best regards,
 Ganesh Kamath.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030615/81ee1682/attachment.htm>


More information about the Javascript mailing list