I am attempting to build an app that allows a user to press a button that says "Play DVD" and it will then launch DVDPlayer.app. I know the best way of doing this is by using NSWorkspace and launchApplication but my problem is getting the button to recognize the command. How do I get the button to work?
Here is the code that I have so far:
dvd.m
#import "dvd.h"
@implementation dvd
- (BOOL)openDvd{
[[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/DVDPlayer.app"];
return TRUE;
}
@end
dvd.h
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <cocoa/Cocoa.h>
#import <ApplicationServices/ApplicationServices.h>
@interface dvd : NSObject
- (BOOL)openDvd;
@end
Any help would be greatly appreciated. Thanks in advance.