如何使用firefox插件执行外部应用程序?
我尝试使用nsIProcess执行.exe文件。但它不工作,也没有给出任何错误消息。我正在使用Firefox10和Windows7。有人能给我提出解决办法吗?谢谢如何使用firefox插件执行外部应用程序?,firefox,firefox-addon,Firefox,Firefox Addon,我尝试使用nsIProcess执行.exe文件。但它不工作,也没有给出任何错误消息。我正在使用Firefox10和Windows7。有人能给我提出解决办法吗?谢谢 var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIProcess); file.initWithPath("C:\\Users\MJ\\Desktop\\Example.FaceDetec
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIProcess);
file.initWithPath("C:\\Users\MJ\\Desktop\\Example.FaceDetection.exe");
file.launch();
您在MJ之前忘记了一个反斜杠:
file.initWithPath(“C:\\Users\\MJ\\Desktop\\Example.FaceDetection.exe”);
因此,您的应用程序不会执行,因为找不到它。也就是说,运行应用程序的更好方法通常是-它允许您指定命令行参数,并且还将提供有用的反馈:
var参数=[“foo”,“bar”];
var process=Components.classes[“@mozilla.org/process/util;1”]
.createInstance(Components.interfaces.nsiproces);
process.init(文件);
进程运行(false,params,params.length);
process.init(文件)代码>这个文件是什么意思?它是文件路径还是只需要一个名称?@MangalaEdirisinghe:它与上面代码中的文件
相同-一个nsIFile
实例。