Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProcess.init]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://etc...Any help/pointers ??
If fileName must point to an executable, likely you have given it the
path to an app bundle. You must descend into this
(Content/MacOS/<exename>) to get something you can give to nsIProcess.
also I need to ask back about (Content/MacOS/<exename>)
The following fails:
var mFile =
Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("LocApp", Components.interfaces.nsIFile);
mFile.append({appName} + ".app");
go4Process.init(mFile);
But the mFile.path also has only:
/Applications/{appName }.app
But don't find any pointer how to set/get that Content/MacOS/
Hope you can help here. Maybe a code snippet anywhere??
G�nter
now I have:
var mFile = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("LocApp", Components.interfaces.nsIFile);
mFile.append("Contents");
mFile.append("MacOS");
mFile.append(appName + ".app";);
go4Process.init(mFile);
and that gives with mFile.path:
/Applications/Contents/MacOS/appName.app
and the 'go4Process.init' fails.
The go4Process is:
const go4Process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
... just to be sure I'm on:.
Darwin(x86-gcc3)
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.11)
Gecko/2009060214
No. The *bundle* name is Postbox.app. The binary inside is going to be
something like /Applcations/Postbox.app/Contents/MacOS/PostBox
You can use 'Show Package Contents' in the finder context menu to see what's
inside a bundle.
--BDS
But using the context menu I find something like:
/Applications/Postbox.app/Contents/MacOS/PostBox/postbox.bin
which is said a "excecutable Unix file".
I'll go for that and hope it does ;-)
Thanks for the moment!!!
It does the job.
:-) :-) G�nter :-) :-)
[30.06.2009 18:23] �Benjamin Smedberg� wrote:
coming back to this .. about starting an application from within a MOZ app.
This was mend for Postbox on MAC/OSX and basically it did it's job.
Here comes the problem:
To enable Thunderbird/Postbox (TB/PB) to process some special cmdline
handling we have used the concept outlined at
https://developer.mozilla.org/en/Chrome/Command_Line
It's working, does it job with WINDOWS and LINUX(Ubuntu) and "partly" on
MAC/OSX.
WIN/LX vs OSX is this:
If TB/PB has not been started before, the cmdline handler works well,
if it's already started TB/PB gives an error dialog with:
restartMessageNoUnlockerMac=A copy of %S is already open. Only one copy
of %S can be open at a time.
The idea was using special command line parameters so we can pass
'action with parameters' from Firefox to TB/PB for searching messages,
sending and composing. That should be possible also if a copy of TB/PB
is running already.
Because it works well with Windows and Linux, the open question is: why
doesn't it work with MAC/OSX .. or better how to solve this one?
G�nter
[30.06.2009 18:23] �Benjamin Smedberg� wrote:
> WIN/LX vs OSX is this:
> If TB/PB has not been started before, the cmdline handler works well,
> if it's already started TB/PB gives an error dialog with:
>
> restartMessageNoUnlockerMac=A copy of %S is already open. Only one copy
> of %S can be open at a time.
>
> The idea was using special command line parameters so we can pass
> 'action with parameters' from Firefox to TB/PB for searching messages,
> sending and composing. That should be possible also if a copy of TB/PB
> is running already.
It is not. On Windows and Linux, if you launch a new binary of the
application we will automatically remote it to the existing instance. On
Mac, the system does that for us automatically with the dock UI and such, so
there is no explicit remoting code in Mozilla. The solution to your problem
is to send some sort of Apple Event to the running instance, although this
is not a very well-understood codepath, so I don't have a lot of good
pointers how to do arbitrary processing based on Apple Events.
--BDS