From ba310e8b58d686ee9897b26a7edab5b778a8d96f Mon Sep 17 00:00:00 2001
From: jnj
Date: Thu, 13 Nov 2008 18:59:12 +0000
Subject: Add remaining plugins
git-svn-id: https://blacktree-elements-public.googlecode.com/svn/trunk@41 57e2f9b5-c12c-0410-8e95-a1ee7272c91a
---
.../A/PrivateHeaders/NDAppleScriptObject.h | 688 +++++++++++++++++++++
1 file changed, 688 insertions(+)
create mode 100644 QSFoundation.framework/Versions/A/PrivateHeaders/NDAppleScriptObject.h
(limited to 'QSFoundation.framework/Versions/A/PrivateHeaders/NDAppleScriptObject.h')
diff --git a/QSFoundation.framework/Versions/A/PrivateHeaders/NDAppleScriptObject.h b/QSFoundation.framework/Versions/A/PrivateHeaders/NDAppleScriptObject.h
new file mode 100644
index 0000000..63ab756
--- /dev/null
+++ b/QSFoundation.framework/Versions/A/PrivateHeaders/NDAppleScriptObject.h
@@ -0,0 +1,688 @@
+/*!
+ @header NDAppleScriptObject
+ @abstract Header file for NDAppleScriptObject.
+ @discussion NDAppleScriptObject is used to represent compiled AppleScripts within Cocoa. The only restriction for use of this code is that you keep the comments with the head files especial my name. Use of this code is at your own risk yada yada yada...
+
+ Created by nathan on Thu Nov 29 2001.
+ Copyright © 2001 Nathan Day. All rights reserved.
+ */
+
+
+#import
+#import
+#import "NDAppleScriptObject_Protocols.h"
+
+extern const short kScriptResourceID;
+extern const NSString * NDAppleScriptOffendingObject;
+extern const NSString * NDAppleScriptPartialResult;
+
+@class NDComponentInstance;
+
+/*!
+ @class NDAppleScriptObject
+ @abstract Class to represent an AppleScript.
+ @discussion As well as representing an AppleScript, NDAppleScriptObject also can maintain seperate context for each AppleScript, useful if you want to run each script within a seperate thread. NDAppleScriptObject is interface compatabile with NSAppleScript
+ */
+@interface NDAppleScriptObject : NSObject
+{
+@private
+ OSAID compiledScriptID,
+ resultingValueID;
+ NDComponentInstance * componentInstance;
+ NSString * scriptSource;
+ long executionModeFlags;
+}
+
+/*!
+ @method compileExecuteString:
+ @abstract compiles and executes the apple script within the passed string.
+ @discussion Executes the script by calling it’s run handler.
+ @param string A string that contains the AppleScipt source to be compiled and executed.
+ @result Returns the result of executing the AppleScript as a Objective-C object, see objectValue: for more details.
+ */
++ (id)compileExecuteString:(NSString *)string;
+
+/*!
+ @method compileExecuteString:componentInstance:
+ @abstract compiles and executes the apple script within the passed string.
+ @discussion Executes the script by calling it’s run handler.
+ @param string A string that contains the AppleScipt source to be compiled and executed.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result Returns the result of executing the AppleScript as a Objective-C object, see resultObject for more details.
+ */
++ (id)compileExecuteString:(NSString *)string componentInstance:(NDComponentInstance *)componentInstance;
+
+/*!
+ @method appleScriptObjectWithString:
+ @abstract returns an NDAppleScriptObject compiled from passed string.
+ @discussion An autorelease version of initWithString: with mode flags set to kOSAModeCompileIntoContext.
+ @param string A string that contains the AppleScipt source to be compiled.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithString:(NSString *)string;
+/*!
+ @method appleScriptObjectWithString:componentInstance:
+ @abstract returns an NDAppleScriptObject compiled from passed string.
+ @discussion An autorelease version of initWithString: with mode flags set to kOSAModeCompileIntoContext.
+ @param string A string that contains the AppleScipt source to be compiled.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithString:(NSString *)string componentInstance:(NDComponentInstance *)componentInstance;
+
+/*!
+ @method appleScriptObjectWithData:
+ @abstract returns an NDAppleScriptObject from the NSData containing a compiled AppleScript.
+ @discussion An autorelease version of initWithData:.
+ @param string A string that contains the AppleScipt source to be compiled.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithData:(NSData *)data;
+
+/*!
+ @method appleScriptObjectWithData:componentInstance:
+ @abstract returns an NDAppleScriptObject from the NSData containing a compiled AppleScript.
+ @discussion An autorelease version of initWithData:.
+ @param string A string that contains the AppleScipt source to be compiled.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithData:(NSData *)data componentInstance:(NDComponentInstance *)componentInstance;
+/*!
+ @method appleScriptObjectWithContentsOfFile:
+ @abstract returns an NDAppleScriptObject by reading in the compiled AppleScipt at passed path.
+ @discussion An autorelease version of initWithContentsOfFile:.
+ @param path A path to the compiled AppleScipt file.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithContentsOfFile:(NSString *)path;
+
+/*!
+ @method appleScriptObjectWithContentsOfFile:componentInstance:
+ @abstract returns an NDAppleScriptObject by reading in the compiled AppleScipt at passed path.
+ @discussion An autorelease version of initWithContentsOfFile:.
+ @param path A path to the compiled AppleScipt file.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithContentsOfFile:(NSString *)aPath componentInstance:(NDComponentInstance *)componentInstance;
+/*!
+ @method appleScriptObjectWithContentsOfURL:
+ @abstract returns an NDAppleScriptObject by reading in the compiled AppleScipt at passed file URL.
+ @discussion An autorelease version of initWithContentsOfURL:.
+ @param URL A file url to the compiled AppleScipt file.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithContentsOfURL:(NSURL *)URL;
+/*!
+ @method appleScriptObjectWithContentsOfURL:componentInstance:
+ @abstract returns an NDAppleScriptObject by reading in the compiled AppleScipt at passed file URL.
+ @discussion An autorelease version of initWithContentsOfURL:.
+ @param URL A file url to the compiled AppleScipt file.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result Returns the NDAppleScriptObject instance.
+ */
++ (id)appleScriptObjectWithContentsOfURL:(NSURL *)URL componentInstance:(NDComponentInstance *)componentInstance;
+
+/*!
+ @method initWithString:
+ @abstract returns an NDAppleScriptObject compiled from passed string.
+ @discussion initWithString: with the default component and mode flags of kOSAModeCompileIntoContext.
+ @param string A string that contains the AppleScipt source to be compiled.
+ @result Returns the NDAppleScriptObject instance.
+ */
+- (id)initWithString:(NSString *)string;
+
+/*!
+ @method initWithString:modeFlags:
+ @abstract returns an NDAppleScriptObject compiled from passed string.
+ @discussion initWithString:modeFlags: with the default component.
+ @param string A string that contains the AppleScipt source to be compiled.
+ @param modeFlags Mode flags passed to OSACompile (see Apple OSA documentation).
+ @result Returns the NDAppleScriptObject instance.
+ */
+- (id)initWithString:(NSString *)string modeFlags:(long)modeFlags;
+/*!
+ @method initWithContentsOfFile:
+ @abstract Intialises receiver with a compiled AppleScipt file.
+ @discussion Initialize the receiver with the compiled AppleScipt file at the supplied path, the compiled AppleScipt can be in either the resource fork or the data fork. If the file is not complied and is instead a AppleScipt as text then use the initWithString:modeFlags: method instead obtaining the string with the method-[NSString initWithFile:].
+ @param path The path for the compiled AppleScipt file.
+ @result An initialized NDAppleScriptObject
+ */
+- (id)initWithContentsOfFile:(NSString *)path;
+/*!
+ @method initWithContentsOfFile:component:
+ @abstract Intialises receiver with a compiled AppleScipt file.
+ @discussion Initialize the receiver with the compiled AppleScipt file at the supplied path and a NDComponentInstance as returned from the method +[NDComponentInstance findNextComponent], the compiled AppleScipt can be in either the resource fork or the data fork. If the file is not complied and is instead a AppleScipt as text then use the initWithString:modeFlags: method instead obtaining the string with the method-[NSString initWithFile:].
+ @param path The path for the compiled AppleScipt file.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result An initialized NDAppleScriptObject
+ */
+- (id)initWithContentsOfFile:(NSString *)path componentInstance:(NDComponentInstance *)componentInstance;
+/*!
+ @method initWithContentsOfURL:
+ @abstract Intialises receiver with a compiled AppleScipt file.
+ @discussion Initialize the receiver with the compiled AppleScipt file at the supplied file url, the compiled AppleScipt can be in either the resource fork or the data fork. If the file is not complied and is instead a AppleScipt as text then use the initWithString:modeFlags: method instead obtaining the string with the method-[NSString initWithURL:].
+ @param URL The file url for the compiled AppleScipt file.
+ @result An initialized NDAppleScriptObject
+ */
+- (id)initWithContentsOfURL:(NSURL *)URL;
+/*!
+ @method initWithContentsOfURL:component:
+ @abstract Intialises receiver with a compiled AppleScipt file.
+ @discussion Initialize the receiver with the compiled AppleScipt file at the supplied file url and a NDComponentInstance as returned from the method +[NDComponentInstance findNextComponent], the compiled AppleScipt can be in either the resource fork or the data fork. If the file is not complied and is instead a AppleScipt as text then use the initWithString:modeFlags: method instead obtaining the string with the method-[NSString initWithURL:].
+ @param URL The file url for the compiled AppleScipt file.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result An initialized NDAppleScriptObject
+ */
+- (id)initWithContentsOfURL:(NSURL *)URL componentInstance:(NDComponentInstance *)componentInstance;
+/*!
+ @method initWithData:
+ @abstract Intialises receiver with compiled AppleScipt data.
+ @discussion Initialize the with a NSData object containing the data for an compiled AppleScipt.
+ @param data A NSData object containing the compiled AppleScipt.
+ @result An initialized NDAppleScriptObject
+ */
+- (id)initWithData:(NSData *)data;
+
+/*!
+ @method initWithString:modeFlags:component:
+ @abstract returns an NDAppleScriptObject compiled from passed string.
+ @discussion Initialzes the recieve by compiling the recieved source, if compilation failes then the error can be returned with the method error and the method isCompiled returns false.
+ @param URL A file url to the compiled AppleScipt file.
+ @result Returns the NDAppleScriptObject instance.
+ */
+- (id)initWithString:(NSString *)string modeFlags:(long)modeFlags componentInstance:(NDComponentInstance *)componentInstance;
+/*!
+ @method initWithData:component:
+ @abstract Intialises receiver with compiled AppleScipt data.
+ @discussion Initialize the with a NSData object containing the data for an compiled AppleScipt and a NDComponentInstance as returned from the method +[NDComponentInstance findNextComponent].
+ @param data A NSData object containing the compiled AppleScipt.
+ @param componentInstance The NDComponentInstance to use the AppleScipt with.
+ @result An initialized NDAppleScriptObject
+ */
+- (id)initWithData:(NSData *)data componentInstance:(NDComponentInstance *)componentInstance;
+
+/*!
+ @method data
+ @abstract returns the compiled script within a NSData instance.
+ @discussion the returned NSData instance contains a compiled script which can be
+ passed to the initWithData:component: method.
+ @result Returns an NSData instance.
+ */
+- (NSData *)data;
+
+/*!
+ @method execute
+ @abstract executes the script.
+ @discussion executes the script by calling it run handler.
+ @result returns YES if execution was successful.
+ */
+- (BOOL)execute;
+
+/*!
+ @method executeOpen
+ @abstract sends an open event.
+ @discussion executes the script by calling it open handler passing an alias list creaed from parameters.
+ @param parameters an NSArray containing paths (NSString) or NSURL’s which is
+ converted into an alias list.
+ @result returns YES if execution was successful.
+ */
+- (BOOL)executeOpen:(NSArray *)parameters;
+
+/*!
+ @method executeEvent:
+ @abstract execute an AppleEvent.
+ @discussion sends an AppleEvent to the script.
+ @param event an NSAppleEventDescriptor containing the apple event.
+ @result returns YES if execution was successful.
+ */
+- (BOOL)executeEvent:(NSAppleEventDescriptor *)event;
+
+/*!
+ @method executeSubroutineNamed:argumentsArray:
+ @abstract execute an AppleScript function.
+ @discussion Executs the AppleScript subroutine name passing the objects within array as positional arguments after being converted to NSAppleEventDescriptors with the method -[NSAppleEventDescriptor descriptorWithObject:].
+ @param name The function name, this is case insensitive.
+ @param array An array of arguments.
+ @result returns YES if execution was successful.
+ */
+- (BOOL)executeSubroutineNamed:(NSString *)name argumentsArray:(NSArray *)array;
+
+/*!
+ @method executeSubroutineNamed:arguments:...
+ @abstract execute an AppleScript function.
+ @discussion Executs the AppleScript subroutine name passing the objects starting with firstObject as positional arguments after being converted to NSAppleEventDescriptors with the method -[NSAppleEventDescriptor descriptorWithObject:].
+ @param name The function name, this is case insensitive.
+ @param firstObject The first object of a list of arguments terminated with nil.
+ @result returns YES if execution was successful.
+ */
+- (BOOL)executeSubroutineNamed:(NSString *)name arguments:(id)firstObject, ...;
+
+/*!
+ @method executeSubroutineNamed:labelsAndArguments:
+ @abstract execute an AppleScript function.
+ @discussion executeSubroutineNamed:labelsAndArguments: executes an AppleScript subroutine with labeled arguments starting with the label label, if the keyword keyASPrepositionGiven is found the remaining arguments will be passed to the method userRecordDescriptorWithObjectAndKeys:arguments: and the result is given the keyword keyASUserRecordFields.
+ For example to execute the AppleScript subroutine
+
+ foo for arg1 given argument:arg2
+
+ you would do the following
+
+ theSubroutine = [theAppleScript executeSubroutineNamed:@"foo"
+ labelsAndArguments:keyASPrepositionFor, arg1,
+ keyASPrepositionGiven, arg2, @"argument", nil];
+
+ which is equivalent to
+
+ theSubroutine = [theAppleScript executeSubroutineNamed:@"foo"
+ labelsAndArguments:keyASPrepositionFor, arg1, keyASUserRecordFields,
+ [NSAppleEventDescriptor userRecordDescriptorWithObjectAndKeys:arg2, @"argument", nil],
+ (AEKeyword)0];
+
+ Possible keywords are;
+
+
+ | Key Word | AppleScript key word |
+ | keyASPrepositionAbout | about |
+ | keyASPrepositionAbove | above |
+ | keyASPrepositionAgainst | against |
+ | keyASPrepositionApartFrom | apart from |
+ | keyASPrepositionAround | around |
+ | keyASPrepositionAsideFrom | aside from |
+ | keyASPrepositionAt | at |
+ | keyASPrepositionBelow | below |
+ | keyASPrepositionBeneath | beneath |
+ | keyASPrepositionBeside | beside |
+ | keyASPrepositionBetween | between |
+ | keyASPrepositionBy | by |
+ | keyASPrepositionFor | for |
+ | keyASPrepositionFrom | from |
+ | keyASPrepositionGiven | given |
+ | keyASPrepositionIn | in |
+ | keyASPrepositionInsteadOf | instead of |
+ | keyASPrepositionInto | into |
+ | keyASPrepositionOn | on |
+ | keyASPrepositionOnto | onto |
+ | keyASPrepositionOutOf | out of |
+ | keyASPrepositionOver | over |
+ | keyASPrepositionSince | since |
+ | keyASPrepositionThrough | through |
+ | keyASPrepositionThru | thru |
+ | keyASPrepositionTo | to |
+ | keyASPrepositionUnder | under |
+ | keyASPrepositionUntil | until |
+ | keyASPrepositionWith | with |
+ | keyASPrepositionWithout | without |
+ | keyASUserRecordFields | key for a list descriptor of user record fields |
+
+
+ To find out the rules for use of the key words see the AppleScript language documentation.
+ @param name The function name, this is case insensitive.
+ @param label The first label of a list of labels and arguments, terminated with a 0 AEKeyword or nil if the end arguments follow the keyword keyASPrepositionGiven.
+ @result returns YES if execution was successful.
+ */
+- (BOOL)executeSubroutineNamed:(NSString *)name labelsAndArguments:(AEKeyword)label, ...;
+
+/*!
+ @method arrayOfEventIdentifier
+ @abstract returns all event identifies the script respondes to.
+ @discussion returns and NSArray of NSDictionarys with the keys "EventClass" and "EventID".
+ @result returns an NSArray of event identifier NSDictionarys.
+ */
+- (NSArray *)arrayOfEventIdentifier;
+/*!
+ @method respondsToEventClass:eventID:
+ @abstract Tests whether the script responds to an AppleEvent.
+ @discussion This method test whether the script responds to the passed event identifier.
+ @param eventClass the event class.
+ @param eventID the event identifier.
+ @result returns true if the script reponds to the event identifier.
+ */
+- (BOOL)respondsToEventClass:(AEEventClass)eventClass eventID:(AEEventID)eventID;
+
+/*!
+ @method respondsToSubroutine:
+ @abstract Tests whether the script responds to a subroutine call.
+ @discussion This method test whether the script inplements the subroutine name, subroutine names are case insensitive and so the string name is converted to lower case first.
+ @param name The subroutine name.
+ @result returns true if the script reponds to the subroutine call.
+ */
+- (BOOL)respondsToSubroutine:(NSString *)name;
+
+/*!
+ @method resultAppleEventDescriptor
+ @abstract Returs the result as an AppleEvent type..
+ @discussion returns the result of the last script execution as an AppleEvent type within an NSAppleEventDescriptor.
+ @result the NSAppleEventDescriptor contains the AppleEvent type result.
+ */
+- (NSAppleEventDescriptor *)resultAppleEventDescriptor;
+
+/*!
+ @method resultObject
+ @abstract Returs the result as an Objective-C object.
+ @discussion converts the AppleEvent type returned from the last script execution into an
+ Objective-C object. The types currently supported are
+
+
+ | AppleScript Type | Objective-C Class |
+ | list | NSArray |
+ | record | NSDictionary |
+ | alias | NSURL |
+ | string | NSString |
+ real integer boolean | NSNumber |
+ | script | NDAppleScriptObject |
+ | anything else | NSData |
+
+
+ @result A subclass of NSObject.
+ */
+- (id)resultObject;
+
+/*!
+ @method resultData
+ @abstract Returs the result as an NSData instance.
+ @discussion returns the raw bytes from the result AppleEvent type.
+ @result the NSData instance.
+ */
+- (id)resultData;
+
+/*!
+ @method resultAsString
+ @abstract returns the result as an OSA formated string.
+ @discussion returns the result as a string by calling OSA’s OSADisplay function. The result is
+ in the same format as seen in Script Editor’s result window.
+ @result the NSString result.
+ */
+- (NSString *)resultAsString;
+
+/*!
+ @method componentInstance
+ @abstract Get the component instance.
+ @discussion The NDComponentInstance represents the connection to the OSA component.
+ @result A NDComponentInstance
+ */
+- (NDComponentInstance *)componentInstance;
+/*!
+ @method executionModeFlags
+ @abstract returns the execution mode flags.
+ @discussion The flags are eqivelent to AESend flags.
+
+
+ | Flag | Description |
+
+ | kOSAModeNeverInteract |
+ The server application should never interact with the user in response to any of the AppleEvents. |
+
+
+ | kOSAModeCanInteract |
+ The server application can interact with the user in response to any AppleEvents. |
+
+
+ | kOSAModeAlwaysInteract |
+ The server applcation can interact with the user. |
+
+
+ | kOSAModeCantSwitchLayer |
+ If both the client and the sever allow interaction, and if the client application is the active application on the local computer and is waiting for a reply (that is, it has set the kAEWAitReply flag), kOSAModeCantSwitchLayer brings the server directly to the forground. Otherwise the Notification Manager is used to request the user bring the server application to the foreground. |
+
+
+ | kOSAModeDontReconnect |
+ The AppleEvent Manager mus not automaticlly try to reconect if the receives a sessClosedErr result code from the PPC Toolbox. |
+
+
+ | kOSAModeDoRecord |
+ Prevents use of kAEDontRecord in sendMode parameter if AESend for the events sent when the script is executed. |
+
+
+
+
+ @result a long contains the execution mode flag bits.
+ */
+- (long)executionModeFlags;
+/*!
+ @method setExecutionModeFlags:
+ @abstract sets the execution mode flags.
+ @discussion The flags are eqivelent to AESend flags.
+
+
+ | Flag | Description |
+
+ | kOSAModeNeverInteract |
+ The server application should never interact with the user in response to any of the AppleEvents. |
+
+
+ | kOSAModeCanInteract |
+ The server application can interact with the user in response to any AppleEvents. |
+
+
+ | kOSAModeAlwaysInteract |
+ The server applcation can interact with the user. |
+
+
+ | kOSAModeCantSwitchLayer |
+ If both the client and the sever allow interaction, and if the client application is the active application on the local computer and is waiting for a reply (that is, it has set the kAEWAitReply flag), kOSAModeCantSwitchLayer brings the server directly to the forground. Otherwise the Notification Manager is used to request the user bring the server application to the foreground. |
+
+
+ | kOSAModeDontReconnect |
+ The AppleEvent Manager mus not automaticlly try to reconect if the receives a sessClosedErr result code from the PPC Toolbox. |
+
+
+ | kOSAModeDoRecord |
+ Prevents use of kAEDontRecord in sendMode parameter if AESend for the events sent when the script is executed. |
+
+
+
+ @param modeFlags a long containing the execution mode flag bits.
+ */
+- (void)setExecutionModeFlags:(long)modeFlags;
+
+/*!
+ @method appleEventTarget
+ @abstract returns an AppleEvent desriptor that can be used in constructing complete AppleEvents.
+ @discussion When construction AppleEvents using the NSAppleEventDescriptor method appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID: to send to the script with the NDAppleScriptObject method executeEvent: the NSAppleEventDescriptor return from this method can be used as the target discriptor.
+ @result A NSAppleEventDescriptor to be used as an AppleEvent target.
+ */
+- (NSAppleEventDescriptor *)appleEventTarget;
+
+/*!
+ @method error
+ @abstract Get Apple Script Errors.
+ @discussion You can use error to get information about errors that occured durring execution or compilation. The returned error info dictionary may contain entries that use any combination of the following keys, including no entries at all. The dictionary returns all of the same keys as within the error dictionary returned with some of Apples NSAppleScript methods.
+
+
+ | Constant | Description |
+
+ | NSAppleScriptErrorMessage |
+ An NSString that supplies a detailed description of the error condition. |
+
+
+ | NSAppleScriptErrorNumber |
+ An NSNumber that specifies the error number. |
+
+
+ | NSAppleScriptErrorAppName |
+ An NSString that specifies the name of the application that generated the error. |
+
+
+ | NSAppleScriptErrorBriefMessage |
+ An NSString that provides a brief description of the error. |
+
+
+ | NSAppleScriptErrorRange |
+ An NSValue that specifies a range. |
+
+
+ | NDAppleScriptOffendingObject |
+ An NSAppleEventDescriptor that specifies an offending object. |
+
+
+ | NDAppleScriptPartialResult |
+ An object that represent a partial result |
+
+
+
+ @result A NSDictionary containing error information
+ */
+- (NSDictionary *)error;
+
+/*!
+ @method compile
+ @abstract Compile a AppleScript.
+ @discussion Compiles the receiver with a mode flag of kOSAModeCompileIntoContext, if it is not already compiled. Returns YES for success or if the script was already compiled, NO otherwise. Currently NDAppleScriptObject compiles scripts at initalization an will only be uncompiled if compilation failed.
+ @result Returns YES if successful.
+ */
+- (BOOL)compile;
+
+/*!
+ @method compileWithModeFlags:
+ @abstract Compile a AppleScript.
+ @discussion Compiles the receiver with the supplied mode flags, if it is not already compiled. Returns YES for success or if the script was already compiled, NO otherwise. Currently NDAppleScriptObject compiles scripts at initalization an will only be uncompiled if compilation failed.
+ @param modeFlags Mode flags passed to OSACompile (see Apple OSA documentation).
+ @result Returns YES if successful.
+ */
+- (BOOL)compileWithModeFlags:(long)modeFlags;
+
+/*!
+ @method isCompiled
+ @abstract Is the AppleScript compiled.
+ @discussion Returns YES if the receiver is already compiled, NO otherwise.
+ @result Returns YES if the receiver is compiled.
+ */
+- (BOOL)isCompiled;
+
+ /*!
+ @method source
+ @abstract Get the AppleScript source
+ @discussion Returns the source code of the receiver if it is available, nil otherwise. It is possible for an NDAppleScriptObject to be a script for which the source code is not available but is nonetheless executable.
+
+ @result A NSString
+ */
+- (NSString *)source;
+
+/*!
+ @method writeToURL:
+ @abstract Writes the receiver as a complied AppleScript.
+ @discussion the compiled script is written to the 'scpt' resource, id 128 of the resource fork of the file.
+ @param URL A file url for the compiled AppleScipt file.
+ @result Returns YES if writting succeeded.
+ */
+- (BOOL)writeToURL:(NSURL *)URL;
+/*!
+ @method writeToURL:inDataFork:atomically:
+ @abstract Writes the receiver as a complied AppleScript.
+ @discussion if inDataFork is YES then the compiled script is written to the data forke of the file otherwise the compiled script is written to the 'scpt' resource, id 128 of the resource fork of the file. If atomically is YES and inDataFork is YES then the receiver is written to a copy of the file which then replaces the original.
+ @param URL A file url for the compiled AppleScipt file.
+ @param inDataFork YES to write the receiver to the data fork instead of the resource fork.
+ @param atomically Write the file attomically.
+ @result return YES if writting succeeded.
+ */
+- (BOOL)writeToURL:(NSURL *)URL inDataFork:(BOOL)inDataFork atomically:(BOOL)atomically;
+
+ /*!
+ @method writeToURL:Id:
+ @abstract Writes the receiver as a complied AppleScript.
+ @discussion the compiled script is written to the 'scpt' resource, with the passed id of the resource fork of the file.
+ @param URL A file url for the compiled AppleScipt file.
+ @param ID The resource id for the compiled AppleScipt data.
+ @result return YES if writting succeeded.
+ */
+- (BOOL)writeToURL:(NSURL *)URL Id:(short)ID;
+/*!
+ @method writeToFile:
+ @abstract Writes the receiver as a complied AppleScript.
+ @discussion the compiled script is written to the 'scpt' resource, id 128 of the resource fork of the file.
+ @param path A path for the compiled AppleScipt file.
+ @result return YES if writting succeeded.
+ */
+- (BOOL)writeToFile:(NSString *)path;
+/*!
+ @method writeToFile:inDataFork:atomically:
+ @abstract Writes the receiver as a complied AppleScript.
+ @discussion if inDataFork is YES then the compiled script is written to the data fork of the file otherwise the compiled script is written to the 'scpt' resource, id 128 of the resource fork of the file. If atomically is YES and inDataFork is YES then the receiver is written to a copy of the file which then replaces the original.
+ @param path A path for the compiled AppleScipt file.
+ @param inDataFork YES to write the receiver to the data fork instead of the resource fork.
+ @param atomically Write the file attomically.
+ @result return YES if writting succeeded.
+ */
+- (BOOL)writeToFile:(NSString *)path inDataFork:(BOOL)inDataFork atomically:(BOOL)atomically;
+/*!
+ @method writeToFile:Id:
+ @abstract Writes the receiver as a complied AppleScript.
+ @discussion the compiled script is written to the 'scpt' resource, with the passed id of the resource fork of the file.
+ @param path A path for the compiled AppleScipt file.
+ @param ID The resource id for the compiled AppleScipt data.
+ @result return YES if writting succeeded.
+*/
+- (BOOL)writeToFile:(NSString *)path Id:(short)ID;
+
+@end
+
+/*!
+ @category NSAppleEventDescriptor(NDAppleScriptValueExtension)
+ @abstract category of NSAppleEventDescriptor.
+ @discussion adds a method to NSAppleEventDescriptor retrieve a NDAppleScriptObject from a NSAppleEventDescriptor.
+ */
+@interface NSAppleEventDescriptor (NDAppleScriptObjectValueExtension)
+/*!
+ @method appleScriptValue
+ @abstract Category method for NSAppleEventDescriptor (NDAppleScriptObjectValueExtension), converts any script data within a AppleEvent descriptor into an NDAppleScriptObject
+ @discussion If an AppleScript return a AppleScript as it’s result, this method can be used to convert the result NSAppleEventDescriptor into a NDAppleScriptObject. The NSAppleEventDescriptor method objectValue will use this method if available.
+ @result a NDAppleScriptObject object for the AppleScript contained within the AppleEvent descriptor.
+ */
+- (NDAppleScriptObject *)appleScriptValue;
+@end
+
+/*!
+ @category NDAppleScriptObject(NSAppleScriptCompatibility)
+ @abstract Provides interface compatability with Apples NSAppleScript
+ @discussion Adds methods to NDAppleScriptObject to make it interface compatible with NSAppleScript. The methods are initWithContentsOfURL:error:, initWithSource:, compileAndReturnError:, executeAndReturnError: and executeAppleEvent:error:.
+ */
+@interface NDAppleScriptObject (NSAppleScriptCompatibility)
+/*!
+ @method initWithContentsOfURL:error:
+ @abstract Initialize a NDAppleScriptObject.
+ @discussion This method is for interface compatability with Apples NSAppleScript
+ @param url A file url for the compiled AppleScipt file.
+ @param errorInfo On return contains a NSDictionary contain errror information.
+ @result An initalized NDAppleScriptObject
+ */
+- (id)initWithContentsOfURL:(NSURL *)url error:(NSDictionary **)errorInfo;
+
+/*!
+ @method initWithSource:
+ @abstract Initialize a NDAppleScriptObject.
+ @discussion This method is for interface compatability with Apples NSAppleScript, it is equivelent to initWithString: but without compiling of the source.
+ @result A NDAppleScriptObject object.
+ */
+- (id)initWithSource:(NSString *)source;
+
+/*!
+ @method compileAndReturnError:
+ @abstract Compile an AppleScipt.
+ @discussion This method is for interface compatability with Apples NSAppleScript
+ @param errorInfo On return contains a NSDictionary contain errror information.
+ @result Returns YES on success.
+ */
+- (BOOL)compileAndReturnError:(NSDictionary **)errorInfo;
+
+/*!
+ @method executeAndReturnError:
+ @abstract Execute an AppleScript.
+ @discussion This method is for interface compatability with Apples NSAppleScript
+ @param errorInfo On return contains a NSDictionary contain errror information.
+ @result Returns YES on success.
+ */
+- (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary **)errorInfo;
+
+/*!
+ @method executeAppleEvent:error:
+ @abstract Execute an AppleScript.
+ @discussion This method is for interface compatability with Apples NSAppleScript
+ @param event an NSAppleEventDescriptor containing the apple event.
+ @param errorInfo On return contains a NSDictionary contain errror information.
+ @result Returns the result NSAppleEventDescriptor on success, nil otherwise.
+ */
+- (NSAppleEventDescriptor *)executeAppleEvent:(NSAppleEventDescriptor *)event error:(NSDictionary **)errorInfo;
+
+@end
--
cgit