Страницы: 1
function launchfile1()
{
var file = Components.classes['@mozilla.org/file/local;1']
.createInstance(Components.interfaces.nsILocalFile);
var process = Components.classes['@mozilla.org/process/util;1']
.getService(Components.interfaces.nsIProcess);
file.initWithPath('c:\windows\notepad.exe');
if(! file.exists())
{
alert('file not found!');
}
else
{
alert('start');
file.launch();
process.init(file);
var arguments='123';
process.run(false, arguments, arguments.length);
}
}
function launchfile2()
{
alert('begin');
const FileFactory = new Components.Constructor("@mozilla.org/file/local;1","nsILocalFile","initWithPath");
str_LocalProgram ='c:\windows\notepad.exe';
try {
alert('try1');
var obj_Program = new FileFactory(str_LocalProgram);
if (! obj_Program.exists())
{
alert('file not found!');
}
} catch (e) { alert('catch1'); alert(e) }try {
…
alert('try2')
Страницы: 1