• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calling cocoa app from command line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling cocoa app from command line


  • Subject: Re: Calling cocoa app from command line
  • From: John Stiles <email@hidden>
  • Date: Thu, 15 Mar 2007 15:17:31 -0700

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Calling cocoa app from command line
      • From: Andreas Mayer <email@hidden>
    • Re: Calling cocoa app from command line
      • From: Patrick Hartling <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>)

  • Prev by Date: Re: Calling cocoa app from command line
  • Next by Date: Re: NSArrayController, saving and reloading sort descriptors
  • Previous by thread: Re: Calling cocoa app from command line
  • Next by thread: Re: Calling cocoa app from command line
  • Index(es):
    • Date
    • Thread