views:

249

answers:

1

I have a bat file which needs to be called from javascript in firefox extension ..

I have bat file present in content/chrome directory.. I tried to call bat file like this ..

var exe = 

Components.classes['@mozilla.org/file/local;1']
          .createInstance(Components.interfaces.nsILocalFile);
exe.initWithPath("chrome://sample/content/test.bat");
exe.launch();

But it's not working ..

+1  A: 

You'll want to use the nsIProcess interface: https://developer.mozilla.org/en/Code%5Fsnippets/Running%5Fapplications#Using%5FnsIProcess

I've used this with batch files before successfully.

(Specifically, here: http://code.google.com/p/extensiondev/source/browse/trunk/content/extensionbuilder.js#915 although some of that code may be out of date!)

Ted Mielczarek