Re: Calling cocoa app from command line
Re: Calling cocoa app from command line
- Subject: Re: Calling cocoa app from command line
- From: Patrick Hartling <email@hidden>
- Date: Thu, 15 Mar 2007 17:38:26 -0500
I am a developer on a virtual reality application development framework
called VR Juggler. This software has support for clustered execution where
multiple computers can be used for rendering the immersive 3D graphics. For
this to work, we have to be able to launch the applications on all the
computers in the cluster, and to help out with that, we wrote software
called Maestro. Maestro runs as a daemon, and users authenticate with it
using a client GUI. Using that GUI, they can then launch their VR
application across all the machines of a cluster with a single click.
So, in the context of Cocoa, I have been working on adding Cocoa support to
the VR Juggler software. Right now, we require X11 on Mac OS X, and I want
to get beyond that limitation. For Mac OS X to attain the same level of
support that we have for other operating systems, we need to be able to log
into OS X machines remotely (via SSH or using the Maestro software) and
launch Cocoa applications using the command line launching style. The
applications will, in all likelihood, be displaying full screen windows, and
such windows are above the shielding window level. Even so, they don't
receive focus when launched directly from a command line--as you pointed
out. Gaining focus isn't such a big deal in this case (I don't think), but I
would still prefer that the VR application be focused while it executes.
That said, I am still working out the kinks in the Cocoa support, and I
haven't tried any remote application launching on Mac OS X yet. As such, I
don't know what to expect or what problems I will encounter. For example, I
don't know if the OS X window server has access rights the way that an X
server or the Windows user desktop do. If access rights need to be granted
to be able to display windows, then the Maestro daemon will take care of
that. I am not to the point of needing to worry about things such as that,
however.
My question was asked primarily out of curiosity as I have just this week
been experimenting with launching Cocoa application bundles directly from
the command line. I am quite glad that this capability exists because these
VR applications tend to rely pretty heavily on command line arguments to set
up execution parameters and such. Using property lists instead of command
line arguments definitely could be an option, but we try pretty hard to
allow users to migrate their application from one OS to another without
having to include a lot of platform-specific code. Property lists and
NSDictionary objects are great IMO, and the applications that I would write
for my company would probably take advantage of these things to give users a
better Mac OS X experience from the software. I cannot speak for anyone else
in that regard, though, and I do not want to force people to have to write
that code to be able to run their VR applications on Mac OS X.
-Patrick
John Stiles wrote:
> Yes (SetFrontProcess), but I think you should tell us more about what
> you're trying to do here.
>
>
> On Mar 15, 2007, at 3:12 PM, Patrick Hartling wrote:
>
>> Is there a way for an application to bring itself forward
>> programmatically
>> to get the same result as using 'open' or by double-clicking on the icon?
>>
>> -Patrick
>>
>> John Stiles wrote:
>>> Also, when running an app directly from the command line, it does not
>>> bring itself forward automatically. It will show up in the back, behind
>>> other running apps.
>>>
>>> On Mar 15, 2007, at 2:52 PM, Clark Cox wrote:
>>>
>>>> On 3/14/07, Mark Ritchie <email@hidden> wrote:
>>>>> On 14-Mar-07, at 3:47 PM, Daryl Thachuk wrote:
>>>>>> Look at 'open'
>>>>>
>>>>> or if you know the path to the application then launch it directly:
>>>>> .../MyApp.app/Contents/MacOS/MyApp
>>>>
>>>> Just an FYI to the OP. These will result in very different running
>>>> environments for your program, and would be desirable in different
>>>> situations.
>>>>
>>>> 'open' will open the application just as double clicking on it would
>>>> have. This means that if an instance of your app is already running,
>>>> it will simply be reactivated (i.e. open will not start a new instance
>>>> of your application)
>>>>
>>>> Running it directly from the command-line (i.e. the second suggestion
>>>> above) will run it as a subprocess of your shell. This means that it
>>>> will inherit your shell's environment, and will have its stdin/out
>>>> attached to the same files as the shell itself, etc. *and* it will not
>>>> reactivate an already running instance of your app.
>>>>
>>>>
>>>> --Clark S. Cox III
>>>> email@hidden
>>
>>
>> --Patrick L. Hartling | VP Engineering, Infiscape
>> Corp.
>> PGP: http://tinyurl.com/2oum9 | http://www.infiscape.com/
>>
>
--
Patrick L. Hartling | VP Engineering, Infiscape Corp.
PGP: http://tinyurl.com/2oum9 | http://www.infiscape.com/
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden