如何使用Firefox插件执行外部应用程序? [英] how to execute an external application using firefox addon?
本文介绍了如何使用Firefox插件执行外部应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var file = Components.classes [@ mozilla.org/file/local;1\"].createInstance(Components。 interfaces.nsIProcess);
file.initWithPath(C:\\ Users \\
file.launch();
解决方案 MJ :
$ b
$ b
file.initWithPath(C:\\\ \\Users\\MJ\\Desktop\\Example.FaceDetection.exe);
所以你的应用程序不执行,因为它没有被发现。也就是说,运行应用程序的更好方式通常是 nsIProcess - 它允许您指定命令line参数,它也会提供有用的反馈:
$ b
var params = [foo,酒吧];
var process = Components.classes [@ mozilla.org/process/util;1]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
process.run(false,params,params.length);
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();
解决方案
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);
这篇关于如何使用Firefox插件执行外部应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文