• 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
Launching a Carbon program with NSTask?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Launching a Carbon program with NSTask?


  • Subject: Launching a Carbon program with NSTask?
  • From: Dan Saul <email@hidden>
  • Date: Sun, 18 Apr 2004 23:09:57 -0500

If written all the code I need to get this to launch Image Capture, but it won't work with the game that is not cocoa but carbon and not in a package.

#import "HITPLauncherController.h"

@implementation HITPLauncherController

- (void)awakeFromNib
{
[mainWindow center];
NSArray *pathArray = [NSArray arrayWithObjects:@"System",@"Library", nil];
NSString *arrString = [pathArray componentsJoinedByString:@"/"];
NSLog(arrString);

NSFileManager *manager = [NSFileManager defaultManager];
NSString * appBundlePath = [[NSBundle bundleForClass:[self class]] bundlePath];
appBundlePath = [appBundlePath stringByDeletingLastPathComponent];
NSLog(appBundlePath);

NSArray * directorylistArray = [manager directoryContentsAtPath:appBundlePath];
NSString * directorylistString = [directorylistArray componentsJoinedByString:@", "];
NSLog(directorylistString);

/* Move files to main */
NSLog(@"Move files to main");
/* Start Moh */
timer = [[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(runAndQuitMohaa) userInfo:nil repeats:NO] retain];
}

- (void)runAndQuitMohaa
{
NSLog(@"RunMoH");
NSTask *banner;
NSPipe *thePipe=[[NSPipe alloc] init];
NSPipe *output=[[NSPipe alloc] init];

banner=[[NSTask alloc] init];
//[banner setLaunchPath:@"/Applications/Image Capture.app/Contents/MacOS/Image Capture"];//test
[banner setLaunchPath:@"/Applications/Games/Medal of Honor/mohaa"];

[banner setStandardOutput:output];
[banner launch];
[banner waitUntilExit];
/* Move files back to mainhitp */
[self cleanUp];
/* Quit */
NSLog(@"Quit");
[NSApp terminate:nil];
/* Release Variables */
[output release];
[thePipe release];
[banner release];

}

- (void)cleanUp
{
NSLog(@"Move files back to mainhitp");
}

@end

I have no idea how to fix this to it will run it this is a carbon cfm application.
_______________________________________________
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.


  • Follow-Ups:
    • Re: Launching a Carbon program with NSTask?
      • From: "M. Uli Kusterer" <email@hidden>
    • Re: Launching a Carbon program with NSTask?
      • From: Michael Hall <email@hidden>
    • Re: Launching a Carbon program with NSTask?
      • From: Charles Srstka <email@hidden>
  • Prev by Date: Receiving modifer-clicks on open menus
  • Next by Date: sheet weirdness
  • Previous by thread: Re: Receiving modifer-clicks on open menus
  • Next by thread: Re: Launching a Carbon program with NSTask?
  • Index(es):
    • Date
    • Thread