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;

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.