Re: How to request another application to do something?
Re: How to request another application to do something?
- Subject: Re: How to request another application to do something?
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 10 Feb 2007 08:21:28 -0500
- Thread-topic: How to request another application to do something?
on 2007-02-10 6:17 AM, Silicon at email@hidden wrote:
> As the title mentioned, for example, If I want to order the text
> editor (located at /Application folder)to open a .txt file in my
> application, how should I accomplish this task?
> Thanks for any help.
Do you mean you have a text file in your app's bundle, and you want your app
to have a menu or button that causes the text file to open in TextEdit?
If so, and if the text file you place in your app's bundle is "owned" by
TextEdit, then you can do what I do: implement an action method in your app
that opens the file, and use Interface Builder to attach it to a menu item
or button. Here's an action method from PreFab UI Browser that does this:
- (IBAction)showLicenseAction:(id)sender {
NSString *path = [[NSBundle mainBundle] pathForResource:@"License"
ofType:@"rtf"];
if (path) {
if (![[NSWorkspace sharedWorkspace] openFile:path]) NSBeep();
}
}
--
PLEASE NOTE MY NEW E-MAIL ADDRESS:
Bill Cheeseman - email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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