• 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: Rolf <email@hidden>
  • Date: Wed, 11 Jun 2003 11:10:36 +0200

Fantastic. Yes that worked !
Thanks :-)
I should have though of this myself. Actually I did try it from a Terminal window. Seeing that didn't work I wrongly assumed it wouldn't from NSTask either ..

/Rolf

11.06.2003 10:41:44, skrev Greg Hulands <email@hidden>:

>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.
_______________________________________________
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: 
 >Re: Launching cocoa app programatically with argument(s) (From: Greg Hulands <email@hidden>)

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