• 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: Opening an external file in a external application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening an external file in a external application


  • Subject: Re: Opening an external file in a external application
  • From: John Love <email@hidden>
  • Date: Tue, 12 Aug 2008 14:10:24 -0400


On Aug 11, 08, at 2:28 PM, John Love wrote:

I have a multiple document Cocoa app where I (try to) open an external file in whatever application the file belongs to -- in my case, an Excel spreadsheet in Excel. The new Cocoa document window shown keeps track of the calculation progress in Excel via a NSProgressIndicator and a NSTextField.

So, instead of opening a text file and showing it directly in the NSWindow of MyDocument, I just want to startup Excel by selecting the appropriate file in Cocoa's open dialog. I have 'XLS8' in my "info.plist" file. The Excel spreadsheet opens up and the NSProgressIndicator starts spinning and the appropriate text is placed in the NSTextField.

I believe I want to do this opening within my override of - readFromURL. Am I on the right track here?

John Love


Found the answer -- I do need to override -readFromURL in the following manner:


- (BOOL) readFromURL:(NSURL*)absoluteURL ofType:(NSString*)typeName error:(NSError**)outError {
NSWorkspace *workSpace;
BOOL success;

workSpace = [NSWorkspace sharedWorkspace];
success = [workSpace openURL:absoluteURL];

if (success) {
// do stuff here
}
else {
// other things here
}
}


I still need to figure out if it is possible for Excel to communicate back to my app via some sort of NSNotification.

I don't have much hope of that .. so what I probably need to focus on is how to display the Excel spreadsheet in my document window.

Any ideas will definitely be very appreciated.

John Love

P.S. -- sorry about the initial double post


_______________________________________________

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: Opening an external file in a external application
      • From: Graham Cox <email@hidden>
References: 
 >Opening an external file in a external application (From: John Love <email@hidden>)

  • Prev by Date: Re: NSImage and zooming PDFs vs. bitmaps
  • Next by Date: I don't understand why this is leaking...
  • Previous by thread: Opening an external file in a external application
  • Next by thread: Re: Opening an external file in a external application
  • Index(es):
    • Date
    • Thread