Re: Launching cocoa app programatically with argument(s)
Re: Launching cocoa app programatically with argument(s)
- Subject: Re: Launching cocoa app programatically with argument(s)
- From: Greg Hulands <email@hidden>
- Date: Wed, 11 Jun 2003 18:41:44 +1000
Why can't you give the NSTask the absolute path to the exectuable
within the app bundle. eg /Applications/MyApp.app/Contents/MacOS/MyApp.
Greg
On Wednesday, June 11, 2003, at 05:44 PM, Rolf wrote:
Hi
I need to launch a cocoa app programatically with arguments from
another cocoa app, and receive notification when the launched app has
terminated (alternatively wait for it to finish).
I have tried the following:
[[NSWorkspace sharedWorkspace] launchApplication:sApp]:
Problem: Does not support commandline arguments. I have tried
appending a space + argument to the path but that doesn't work.
NSTask * myTask = [NSTask launchedTaskWithLauncPath: sApp
arguments:[NSArray arrayWithObjects:@"/silent",nil]];
[myTask waitUntilExit];
Problem: Doesn't work with cocoa apps (bundles). I get a "permission
denied" exception. BTW: Incredibly this exception is not caught by an
enclosed exception handler. Other exceptions (such as missing file)
are caught.
I don't think NSBundle can be used either (no way to pass arguments +
no notification when terminated).
I'm sure there's a very simple way of doing this. Anybody know how ?
/Rolf
_______________________________________________
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.