tags:

views:

229

answers:

4

I want to execute a process named notepad.exe or any exes in javascript and i want to handle the process in javascript by giving input and so on. I think there is a shell command used in javascript to create process can anybody brief me or help me with the example how to work with process in javascript?

+6  A: 

Not possible. JavaScript does not have any context or control outside of your browser window. ActiveX is a viable alternative, but not a good one.

Nathan Taylor
+1  A: 

Check this page to see if it helps. But I recommend you DO NOT do it.

http://www.dotnetspider.com/resources/19547-Run-exe-file-Java-Script.aspx

What exactly is your requirement. May be we can come up with a better solution.

Shoban
i want to create a process and i want to pass text input to that process
Rajesh Kumar J
Why are you doing it in javascript? Why creating a process. Can you give more info?
Shoban
i have a application which can control mic and headphone and make a voice call to another system. I want to handle that application using javascript by giving input and getting the output because my application is web application to control that application in the local system
Rajesh Kumar J
+2  A: 

In a regular web page that is not possible. The script isn't allowed to create the shell object that is needed.

You would have to use an .hta (hypertext application) page to get the permission required for this.

Example:

<html>
<head>
<title></title>
<script>
new ActiveXObject('Shell.Application').ShellExecute('Notepad.exe');
</script>
</head>
<body>
</body>
</html>
Guffa
.hta can you give me an example page
Rajesh Kumar J
I added an example above.
Guffa
ya i got it is working but i want to know that i can able to send input to that application
Rajesh Kumar J
Add another parameter to send a parameter string to the application. See ref: http://msdn.microsoft.com/en-us/library/bb774148%28VS.85%29.aspx
Guffa
this above javascript code is not working on the browser can you help me but it was working separately in js file
Rajesh Kumar J
do i want to enable something in the browser?
Rajesh Kumar J
Which browser? The hta page is an IE-only feature.
Guffa
A: 

This is not possible on purpose. Obviously people would not want untrusted websites to control tasks on their computer. That would make it very easy to hack in their computers.

What do you need this functionality for?

Adrian Grigore
this application will be for the paticular group only. not all the people can use this web application
Rajesh Kumar J