macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

commandDescriptionWithAppleEventClass:andAppleEventCode:

イベントクラスとコマンドのコードのスクリプトコマンド定義を返します
-(NSScriptCommandDescription *)commandDescriptionWithAppleEventClass:(unsigned long)eventClass:
                andAppleEventCode:(unsigned long)commandCode:

解説

イベントクラスとコマンドのコードのスクリプトコマンド定義を返します。

返り値

( NSScriptCommandDescription * )

スクリプトコマンド定義

引数

( unsigned long )eventClass

イベントクラス

( unsigned long )commandCode

コマンドコード

クラス

NSScriptSuiteRegistry

Instance Methods

使用可能

10.0

参照

- commandDescriptionsInSuite:
- registerCommandDescription:

例文

- (IBAction)myAction:(id)sender;
{
//スクリプトコマンド辞書
NSDictionary *dicWithNumber = 
    [NSDictionary dictionaryWithObjectsAndKeys:
    @"supp",@"AppleEventCode",
    @"NO",@"Optional",
    @"NSNumber<Int>",@"Type",nil];
NSDictionary *dicArguments = 
    [NSDictionary dictionaryWithObjectsAndKeys:
    dicWithNumber,@"withNumber",
    nil];
NSDictionary *dicScriptControll = 
    [NSDictionary dictionaryWithObjectsAndKeys:
    @"Test",@"AppleEventClassCode",
    @"sadd",@"AppleEventCode",
    dicArguments,@"Arguments",
    @"NSScriptCommand",@"CommandClass",
    @"long",@"ResultAppleEventCode",
    @"NSNumber<Int>",@"Type",
    nil];
//スクリプトコマンド記述作成
NSScriptCommandDescription *scd = 
    [[NSScriptCommandDescription alloc]
        initWithSuiteName:@"test"
        commandName:@"ScriptControll"
        dictionary:dicScriptControll
        ];
     
NSScriptSuiteRegistry *sRegistry =[NSScriptSuiteRegistry sharedScriptSuiteRegistry];

NSScriptCommandDescription *scmd ;

[sRegistry registerCommandDescription:scd];
scmd = [sRegistry 
                commandDescriptionWithAppleEventClass:'Test'
                andAppleEventCode:'sadd'
                ];

NSLog([NSString stringWithFormat:@"%@",[scmd description]]);
}