Martin Honnen wrote:
Quote:
Ulf Kadner wrote:
Daher meine Frage ob JS auch sowas wie exec(), system() ö.ä. bietet?
JavaScript selbst sicher nicht, aber die Umgebung ("host"), in der
JavaScript eingesetzt wird.
Für Mozilla-Erweiterungen also
URL:http://www.xulplanet.com/references/xpcomref/ |
Hallo Martin!
Hab ich mir gleich gebookmarkt. Danke.
Für alle die es interessiert. Folgenden (ungetesteten Code habe ich mir
dazu bisher zusammen gebaut. Werds Morgen mal prüfen.
Auszug aus Klasse ApplicationRunner:
makeLocalFile: function(path)
{
var file;
try
{
file = path.QueryInterface(Components.interfaces.nsILocal File);
}
catch (err)
{
file = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile) ;
file.initWithPath(path);
}
return file;
}
runProgram: function(theFile, cmdArgs)
{
const nsIProcess = Components.interfaces.nsIProcess;
const CONTRACTID_PROCESS = "@mozilla.org/process/util;1";
var execFile = ApplicationRunner.makeLocalFile(theFile);
var numArgs = cmdArgs.length;
var theProcess = Components.classes[CONTRACTID_PROCESS].
createInstance(nsIProcess);
theProcess.init(execFile);
theProcess.run(false, cmdArgs, numArgs);
}
Vieleicht brauchts ja mal jemand irgendwie.
MfG, Ulf
--
_,
_(_p> Ulf [Kado] Kadner
\<_)
^^