I try to execute .exe file using nsIProcess. But it is not working and not giving any error message. I am working on firefox 10 and windows 7. Can anybody suggest me any solution? Thanks
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIProcess);
file.initWithPath("C:\\Users\MJ\\Desktop\\Example.FaceDetection.exe");
file.launch();
Firefox's Task Manager feature lets you see which tabs or extensions are using a lot of memory or energy. This feature can be useful when diagnosing high CPU or memory usage in Firefox.
Open Firefox. In the window's upper-right corner, click the Open Applications Menu icon.
You forgot one backslash before MJ
:
file.initWithPath("C:\\Users\\MJ\\Desktop\\Example.FaceDetection.exe");
So your application doesn't execute because it isn't being found. That said, the better way to run applications is usually nsIProcess - it allows you to specify command line parameters and it will also provide useful feedback:
var params = ["foo", "bar"];
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
process.run(false, params, params.length);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With