Re: Using Terminal within Cocoa App.
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