• 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: Adding commandline batch mode to Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding commandline batch mode to Cocoa app


  • Subject: Re: Adding commandline batch mode to Cocoa app
  • From: Carsten <email@hidden>
  • Date: Sun, 23 Mar 2008 00:01:53 +0100

The script installation in a more central place is an interesting
thought. Is /usr/local/bin the Apple-sanctioned place for
user-installed commandline utilities, rather than something like (the
non-existent) /Users/<username>/bin? I could also install such a
script alongside the .app bundle, which is a thought which had crossed
my mind before I decided to ask more experienced Mac developers, but
that might lead to path problems or long paths again, of course.

Automator-enabling is something which I would tackle at a later stage,
I think. It might not be hard, but it could take me a lot of reading
and learning to get to the point where I would realise this :) I will
focus on separating engine from GUI cleanly, for now, and learning
Cocoa.

Thanks for the reply. I think that'll get me going in the right
general direction.

Carsten


On 22/03/2008, Tom Harrington <email@hidden> wrote:
> On Sat, Mar 22, 2008 at 4:26 PM, Carsten <email@hidden> wrote:
>  >  However, image processing apps can benefit from batch modes, and
>  >  although some things can be nicely handled by an in-app batch manager,
>  >  the ideal would be to also allow the application to be run from the
>  >  commandline, as a traditional unix utility.
>  >
>  >  Given the .app bundle format of Cocoa apps, I don't quite see how I
>  >  would do this. In main(), I have added an if contingent on the
>  >  existence of commandline parameters (which can be refined in case Mac
>  >  OS X uses these to launch drag-n-drop scenarios, something which I
>  >  don't know yet), which doesn't load the GUI in case the app has been
>  >  launched in commandline batch mode, but the executable is deep inside
>  >  the .app bundle...
>  >
>  >  What is the traditional Mac OS X/Cocoa way of handling such a
>  >  scenario, or is it simply not do it like this, and to force the user
>  >  to use an in-app batch manager?
>
>
> You could just use the executable in the .app bundle, though it would
>  lead to some very long command lines.  For example you can run
>  TextEdit with "/Applications/TextEdit.app/Contents/MacOS/TextEdit".
>
>  One approach that some apps take is to have a separate command-line
>  tool which could be installed in /usr/local/bin or some other more
>  normal-seeming place.  With this approach you'd probably have a
>  regular drag-install app bundle with a menu item to optionally install
>  the command-line tool.  Depending on your architecture the
>  command-line tool could be as simple as a symbolic link to the main
>  bundle's binary.
>
>  Depending on your requirements, you might consider whether the
>  batch-mode processing would be better implemented as an Automator
>  action.
>
>  --
>  Tom Harrington
>  email@hidden
>  AIM: atomicbird1
>  _______________________________________________
>
>  Cocoa-dev mailing list (email@hidden)
>
>  Please 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
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: Adding commandline batch mode to Cocoa app
      • From: Marcus <email@hidden>
References: 
 >Adding commandline batch mode to Cocoa app (From: Carsten <email@hidden>)
 >Re: Adding commandline batch mode to Cocoa app (From: "Tom Harrington" <email@hidden>)

  • Prev by Date: Re: Adding commandline batch mode to Cocoa app
  • Next by Date: CoreAnimation Memory Use/Eating Memory
  • Previous by thread: Re: Adding commandline batch mode to Cocoa app
  • Next by thread: Re: Adding commandline batch mode to Cocoa app
  • Index(es):
    • Date
    • Thread