• 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 cocoa app programatically with argument(s)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Launching cocoa app programatically with argument(s)
      • From: Rolf <email@hidden>
References: 
 >Launching cocoa app programatically with argument(s) (From: Rolf <email@hidden>)

  • Prev by Date: Launching cocoa app programatically with argument(s)
  • Next by Date: Re: Launching cocoa app programatically with argument(s)
  • Previous by thread: Launching cocoa app programatically with argument(s)
  • Next by thread: Re: Launching cocoa app programatically with argument(s)
  • Index(es):
    • Date
    • Thread