Jordi Llonch wrote:
Hi,

I'm looking for execute an external perl program from my thunderbird
extension (XPI).
I'm have seen this component:
"@mozilla.org/appshell/appShellService;1"
But I'm not sure that this is the way.

To launch a file, you may use the launch method of a nsILocalFile instance:

// path might be any file: "c:\\temp\\test.gif"
function launchFile(path) {
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(path);
file.launch();
}


If you want to launch an executable, you might us the nsIProcess interface:

function launchApp(args,wait) {
// path to your executable
var launcher = 'c:\\app.exe';
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);


    file.initWithPath(launcher);

if (!args)
args = new Array();
var proc = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
proc.init(file);
return proc.run(wait === true, args, args.length);
}


args must be an array holding the arguments you want to pass. wait is a boolean value indicating if the script should pause until the process runs.

HTH
Daniel
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to