macOS/iOS API解説

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

目次

argumentNames

レシーバの引数名を配列で返します

解説

レシーバの引数名を配列で返します。

返り値

( NSArray * )

引数の配列

引数

クラス

NSScriptCommandDescription

Instance Methods

使用可能

10.0

参照

例文

//スクリプトコマンド辞書
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
        ];
NSNumber * number = (NSNumber *)[[sCommand evaluatedArguments] 
                                                objectForKey:@"withNumber"];

NSScriptCommand *sc = [scd createCommandInstance];                                   
NSLog([NSString stringWithFormat:@"%@",[[[sc commandDescription] argumentNames] description]]);
		return number;
	}