[Slogger] Running a programm from within a custom javascript

Ken Schutte kschutte at csail.mit.edu
Wed Feb 14 07:16:21 PST 2007


Something like this might work:
----------------------

var myCommand =  Components.classes["@mozilla.org/file/local;1"]
     .createInstance(Components.interfaces.nsILocalFile);
var myProcess = Components.classes["@mozilla.org/process/util;1"]
	.createInstance(Components.interfaces.nsIProcess);

myCommand.initWithPath("C:\the_full_path\to_your_program\asdf.exe);
myProcess.init(myCommand);

var args = ["arg1","arg2"];
myProcess.run(false, args, args.length);

---------------------------

These are part of Mozilla's XPCOM stuff, rather than general javascript.
http://www.xulplanet.com/references/xpcomref/ifaces/nsIProcess.html

Ken



Peter wrote:
> Hi
> 
> Is it possible to run a program (ex. notepad.exe with command line
> params) from within a
> profiles custom javascript ?
> 
> Thanks for your help.
> Peter
> 
> _______________________________________________
> Slogger mailing list
> Slogger at mozdev.org
> http://mozdev.org/mailman/listinfo/slogger


More information about the Slogger mailing list