2010-07-11 29 views
2

首先,我完全陌生的OBJ-C請到容易對我說:d保存OSAScriptView的內容爲「.scpt」文件到一個預定義文件夾

我建立一個應用程序,它基本上沒有與AppleScript編輯器所做的一樣。

我已經使用了一個OSAScriptView,我想要做的是將這個OSAScriptView的內容保存爲一個.scpt文件在一個預定義的文件夾中。 (如/documents/myscripts/newscript.scpt)

在此先感謝!

回答

2

OSAScript包含您正在查找的方法。

@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; 

你可以自己創建它,或使用類OSAScriptController,它會自動創建一個。

+0

謝謝sooooo多! – johnozbay 2010-07-11 21:06:15

相關問題