• 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: Using Terminal within Cocoa App.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Terminal within Cocoa App.


  • Subject: Re: Using Terminal within Cocoa App.
  • From: Andrew Farmer <email@hidden>
  • Date: Wed, 16 Jan 2008 01:20:58 -0800

On 16 Jan 08, at 00:25, Caroline wrote:
I want to run some App by using Terminal script.
My Cocoa App can run Terminal by using NSTask as follow.

This is not an appropriate use of NSTask.

NSTask *task = [[NSTask alloc] init];
NSPipe *pipe = [NSPipe pipe];

[task setStandardOutput:newPipe];
[task setLaunchPath:@"/Applications/Utilities/Terminal.app/Contents/ MacOS/Terminal"];
[task setArguments:[NSArray arrayWithObjects:[NSString stringWithFormat:@"cd %@", someApp_Path],nil]];
[task launch];


I expect to set Terminal command "cd Path..." (ex. cd /Users/ Desktop/...), and excute the someApp,
but there is no event.

Terminal is a Cocoa application. It doesn't accept command-line arguments like that.


How can I develop my Cocoa App to set automatically Terminal command, and someApp executes?
Is it impossible?

Use Apple Events. _______________________________________________

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


References: 
 >Using Terminal within Cocoa App. (From: Caroline <email@hidden>)

  • Prev by Date: Using Terminal within Cocoa App.
  • Next by Date: Re: [SOLVED] CALayer/CAAnimation doesn't animate
  • Previous by thread: Using Terminal within Cocoa App.
  • Next by thread: Re: Using Terminal within Cocoa App.
  • Index(es):
    • Date
    • Thread