O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSAppleScript — Mac OS X 10.2

Synopsis

This class gives clients the ability to load, compile, and run AppleScripts. This class provides methods to initialize the class with either text source code, or with a precompiled script. With an initialized object, clients can compile or execute scripts. The Application Kit declares an extension to the NSAppleScript class that is used to obtain colored source code for a given script.

image with no caption

@interface NSAppleScript : NSObject <NSCopying>
                                  // Initializers
   - (id)initWithContentsOfURL:(NSURL *)url 
                                 error:(NSDictionary **)errorInfo;
   - (id)initWithSource:(NSString *)source;
                                  // Instance Methods
   - (BOOL)compileAndReturnError:(NSDictionary **)errorInfo;
   - (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary **)errorInfo;
   - (NSAppleEventDescriptor *)executeAppleEvent:(NSAppleEventDescriptor *)event 
                                 error:(NSDictionary **)errorInfo;
   - (BOOL)isCompiled;
   - (NSAttributedString *)richTextSource;
   - (NSString *)source;
                                  // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required