Launching cocoa app programatically with argument(s)
Launching cocoa app programatically with argument(s)
- Subject: Launching cocoa app programatically with argument(s)
- From: Rolf <email@hidden>
- Date: Wed, 11 Jun 2003 09:44:41 +0200
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.