Re: Opening an external file in a external application
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