• 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
In receiver application, getting file passed in from NSWorkspace openFile:withApplication:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

In receiver application, getting file passed in from NSWorkspace openFile:withApplication:


  • Subject: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:
  • From: Ryan Chapman <email@hidden>
  • Date: Mon, 17 Mar 2008 09:56:19 -0700 (PDT)

Hi all,


I have an application that uses NSWorkspace openFile:withApplication: to launch another application:


 [[NSWorkspace sharedWorkspace] openFile:@"/tmp/test.mp3"
                         withApplication:@"/Applications/MaxPostProcessing.app"]


In MaxPostProcessing.app, how can I determine the file that was the parameter passed to openFile:  ??


I've tried using the arguments (argv) passed into main(), but only see "-psn_0_188462" as argv[1].
I also tried NSNotificationCenter, but am not seeing any output from my observer method obsMethod:(id)aNotification


Can someone point me in the right direction?


Thanks alot!


-Ryan








int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];


	Notifier *notifier = [[Notifier alloc] init];
	closelog();


    [pool drain];
    return 0;
}




@implementation Notifier


- (void)init {
	[super init];
	NSNotificationCenter *notificationCtr;
	notificationCtr = [[NSWorkspace sharedWorkspace] notificationCenter];
	// Register for all notifications
	[notificationCtr addObserver:self selector:@selector(obsMethod:) name:nil object:nil];
	syslog(LOG_WARNING, "Notifier.m: added observer");
}


- (void)obsMethod:(id)aNotification {
	syslog(LOG_WARNING, "Notification name=%s", [[aNotification name] cStringUsingEncoding:NSASCIIStringEncoding]);


}

- (void)dealloc {
	NSNotificationCenter *notificationCtr;
	notificationCtr = [[NSWorkspace sharedWorkspace] notificationCenter];
	[notificationCtr removeObserver:self];
	[super dealloc];
}
@end





_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:
      • From: Robert Tillyard <email@hidden>
    • Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Modifying glyph storage in NSLayoutManager
  • Next by Date: Re: Sorting arrays with strings
  • Previous by thread: Re: Modifying glyph storage in NSLayoutManager SOLVED
  • Next by thread: Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:
  • Index(es):
    • Date
    • Thread