The class OSAScript
contains the method you are looking for.
@interface OSAScript : NSObject
// Instance Members
- (BOOL)compileAndReturnError:(NSDictionary**)errorInfo;
- (BOOL)isCompiled;
- (BOOL)writeToURL:(NSURL*)url ofType:(NSString*)type error:(NSDictionary**)errorInfo;
- (BOOL)writeToURL:(NSURL*)url ofType:(NSString*)type usingStorageOptions:(OSAStorageOptions)storageOptions error:(NSDictionary**)errorInfo;
- (NSAppleEventDescriptor*)executeAndReturnDisplayValue:(NSAttributedString**)displayValue error:(NSDictionary**)errorInfo;
- (NSAppleEventDescriptor*)executeAndReturnError:(NSDictionary**)errorInfo;
- (NSAppleEventDescriptor*)executeAppleEvent:(NSAppleEventDescriptor*)event error:(NSDictionary**)errorInfo;
- (NSAppleEventDescriptor*)executeHandlerWithName:(NSString*)name arguments:(NSArray*)arguments error:(NSDictionary**)errorInfo;
- (NSAttributedString*)richTextFromDescriptor:(NSAppleEventDescriptor*)descriptor;
- (NSAttributedString*)richTextSource;
- (NSData*)compiledDataForType:(NSString*)type usingStorageOptions:(OSAStorageOptions)storageOptions error:(NSDictionary**)errorInfo;
- (NSString*)source;
- (NSURL*)url;
- (OSALanguage*)language;
- (id)initWithCompiledData:(NSData*)data error:(NSDictionary**)errorInfo;
- (id)initWithContentsOfURL:(NSURL*)url error:(NSDictionary**)errorInfo;
- (id)initWithContentsOfURL:(NSURL*)url language:(OSALanguage*)language error:(NSDictionary**)errorInfo;
- (id)initWithSource:(NSString*)source language:(OSALanguage*)language;
- (id)initWithSource:(NSString*)source;
- (void)setLanguage:(OSALanguage*)language;
You can create it yourself, or use the class OSAScriptController
, which will create one automatically.