I have written an .app which is launched many times until the running instance 
shuts down finally. The code
to start it looks like this:

    NSTask* task = [[NSTask alloc] init];
    [task setLaunchPath: @"/usr/bin/open"];
    NSString* app = [NSString stringWithFormat:@"%s", launchApp]; // launchApp 
is the app name
    NSArray* arguments = [NSArray arrayWithObjects: app, nil];
    NSLog(@"==%@", arguments);
    [task setArguments: arguments];
    [task launch];
   ...

Like regular GUI applications, a new instance of my application does not come 
up when above code
Is executed. The application delegate has implemented 
applicationShouldHandleRepoen:hasVisibleWindows:
This method returns 'NO' in the end. I want to access the command line 
arguments passed to the application
in this method implementation. Is it possible? If yes, could someone point me 
to the relevant API please?
I tried NSProcessInfo but it (correctly) gives me the arguments passed to the 
running instance.

The idea is to launch the application with different arguments so that it can 
do different
stuff every time. This design is inspired as a result of porting this code from 
other platforms, so I
would be willing to look at other design alternatives if it does not work well 
in the Mac world. However
I would like to give existing solution a try before I do that.

Thanks in advance
Hirendra

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to