Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling cocoa app from command line



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/



_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Calling cocoa app from command line (From: dew drops <email@hidden>)
 >Re: Calling cocoa app from command line (From: Daryl Thachuk <email@hidden>)
 >Re: Calling cocoa app from command line (From: Mark Ritchie <email@hidden>)
 >Re: Calling cocoa app from command line (From: "Clark Cox" <email@hidden>)
 >Re: Calling cocoa app from command line (From: John Stiles <email@hidden>)
 >Re: Calling cocoa app from command line (From: Patrick Hartling <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.