executeAppleEvent:error:
Index>Foundation>NSAppleScript
アップルイベントを実行します
-(NSAppleEventDescriptor *)executeAppleEvent:(NSAppleEventDescriptor *)event:
error:(NSDictionary **)errorInfo:
解説
アップルイベントを実行します。
返り値
( NSAppleEventDescriptor * )
アップルイベントデスクリプタ
引数
( NSAppleEventDescriptor * )event
アップルイベントデスクリプタ
( NSDictionary ** )errorInfo
エラー情報の辞書
フレームワーク
Foundation
クラス
NSAppleScript
Instance Methods
使用可能
10.2
参照
例文
#import "SetImage.h" @implementation SetImage - (IBAction)set:(id)sender { //ファインダで選択しているファイルをオープン 予定 //アップルスクリプトオブジェクトを作る NSAppleScript *script; NSDictionary *error;//エラー NSAppleEventDescriptor *aeResult;//アップルイベントデスクリプタ NSAppleEventDescriptor *aeTarget=[[ NSAppleEventDescriptor alloc ] init] ; [ aeTarget paramDescriptorForKeyword:'fsel' ]; //アップルイベントデスクリプタを作る NSAppleEventDescriptor *aeDesc= [ NSAppleEventDescriptor appleEventWithEventClass:kAEFinderEvents//'FNDR' eventID: kAEOpenSelection//'sope' targetDescriptor: aeTarget returnID: kAutoGenerateReturnID transactionID: kAnyTransactionID ]; script = [ [ NSAppleScript alloc ] init];//NSAppleScriptインスタンス作る aeResult = [script executeAppleEvent:aeDesc error:&error];//AppleEvent送信 //デバッグ用 //NSLog([aeDesc description]); NSLog([error description]); } @end