• 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: NSTask Help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask Help


  • Subject: Re: NSTask Help
  • From: Scott Anguish <email@hidden>
  • Date: Mon, 13 Jan 2003 16:21:41 -0500

On Monday, January 13, 2003, at 03:32 PM, Rhon Fitzwater wrote:

Here is what I have so far (there is a lot more code that works now,
but this is where the perl and applescripts need to get executed):



You can practically copy and paste some of this out of the docs...

http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/OperatingSystem/Tasks/createtask.html

- (void)runTask:(id)sender
{
NSTask *aTask = [[NSTask alloc] init];
NSMutableArray *args = [NSMutableArray array];

/* set arguments */
[args addObject:[[inputFile stringValue] lastPathComponent]];
[args addObject:[outputFile stringValue]];
[aTask setCurrentDirectoryPath:[[inputFile stringValue]
stringByDeletingLastPathComponent]];
[aTask setLaunchPath:[taskField stringValue]];
[aTask setArguments:args];
[aTask launch];
}


http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/OperatingSystem/Tasks/endingtask.html


-(id)init {
self = [super init];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(checkATaskStatus:)
name:NSTaskDidTerminateNotification
object:nil];
return self;
}

- (void)checkATaskStatus:(NSNotification *)aNotification {
int status = [[aNotification object] terminationStatus];
if (status == ATASK_SUCCESS_VALUE)
NSLog(@"Task succeeded.");
else
NSLog(@"Task failed.");
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSTask Help (From: Rhon Fitzwater <email@hidden>)

  • Prev by Date: Re: positioning items in a drawer
  • Next by Date: Re: WebCore and PDF
  • Previous by thread: NSTask Help
  • Next by thread: Re: NSTask Help
  • Index(es):
    • Date
    • Thread