source
アップルスクリプトオブジェクトのソースを返します
解説
アップルスクリプトオブジェクトのソースを返します。
実行専用アプリケーションではnilが返されます。
返り値
( NSString * )
文字列
引数
フレームワーク
Foundation
クラス
NSAppleScript
Instance Methods
使用可能
10.2
参照
例文
#import "SetImage.h" @implementation SetImage - (IBAction)set:(id)sender { //開けるファイル拡張子の配列 NSArray *imgTypes = [ NSArray arrayWithObject : @"script" ]; //OpenPanelを作る NSOpenPanel *opPanel = [ NSOpenPanel openPanel ]; //アップルスクリプトオブジェクトを作る NSAppleScript *script; NSDictionary *error; //OpenPanelの結果のボタン番号 int opRet; //OpenPanelでファイル選択 opRet = [ opPanel runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか file : @"Documents" //どのファイルを選択しておくか types : imgTypes ];//選べるファイルタイプ if ( opRet == NSOKButton ) { // OPENPanelのボタンがOKなら //NSImageを作ってファイルから読み込む script = [ [ NSAppleScript alloc ] initWithContentsOfURL: [NSURL fileURLWithPath:[opPanel filename]] error:&error ]; NSLog([script source]); } } @end