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

Re: Launching a Carbon program with NSTask?


  • Subject: Re: Launching a Carbon program with NSTask?
  • From: Charles Srstka <email@hidden>
  • Date: Sun, 18 Apr 2004 23:51:34 -0500

NSTask only works with Mach-O binaries, so if you wanted to launch a CFM app with it, you'd have to pass its path as an argument to /System/Library/Frameworks/Carbon.framework/Versions/A/Support/ LaunchCFMApp .

However, I don't really recommend doing that - who knows if the path to that support program could change in the future? Instead, I would just use NSWorkspace to launch the app.

Charles

On Apr 18, 2004, at 11:09 PM, Dan Saul wrote:

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.
_______________________________________________
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: 
 >Launching a Carbon program with NSTask? (From: Dan Saul <email@hidden>)

  • Prev by Date: sheet weirdness
  • Next by Date: Newbie question re: NSArrayController
  • Previous by thread: Launching a Carbon program with NSTask?
  • Next by thread: Re: Launching a Carbon program with NSTask?
  • Index(es):
    • Date
    • Thread