• 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: check if app opens with a document on startup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check if app opens with a document on startup


  • Subject: Re: check if app opens with a document on startup
  • From: Torsten Curdt <email@hidden>
  • Date: Fri, 23 May 2008 18:12:15 +0200


On May 23, 2008, at 16:52, John Stiles wrote:

Note that these delegate methods will not work properly until your Info.plist has been updated to reflect the file types which your app supports.

Sure

All good. But I was wondering if it is possible to find out if the application has been opened by dragging a document onto it.

Your delegate will get one of these calls:

- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames;
#endif


I think you get openFiles: if you implement that method, else it falls back to calling openFile: one or more times.

If you don't get any of these calls before - applicationDidFinishLaunching:, you don't have any docs to open.

Hm ...somehow missed that response. But got it working myself. It's actually much simpler:


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
int documentCount = [[[NSDocumentController sharedDocumentController] documents] count];


cheers
--
Torsten
_______________________________________________

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: check if app opens with a document on startup
      • From: Jens Alfke <email@hidden>
References: 
 >check if app opens with a document on startup (From: Torsten Curdt <email@hidden>)
 >Re: check if app opens with a document on startup (From: Jens Alfke <email@hidden>)
 >Re: check if app opens with a document on startup (From: John Stiles <email@hidden>)

  • Prev by Date: Re: NSProgressIndicator -- delete the first message with same title
  • Next by Date: Re: Cocoa-dev Digest, Vol 5, Issue 885
  • Previous by thread: Re: check if app opens with a document on startup
  • Next by thread: Re: check if app opens with a document on startup
  • Index(es):
    • Date
    • Thread