Instance Method インスタンスメソッド

scriptingValue(for:)

Given an object specifier, returns the specified object or objects in the receiving container. あるオブジェクト指定子を与えられて、受け取っているコンテナの中の指定されたオブジェクトまたは複数のオブジェクトを返します。

Declaration 宣言

func scriptingValue(for objectSpecifier: NSScriptObjectSpecifier) -> Any?

Parameters パラメータ

objectSpecifier

An object specifier to be evaluated. 評価されるオブジェクト指定子。

Return Value 戻り値

The specified object or objects in the receiving container. 受け取っているコンテナの中の指定されたオブジェクトまたは複数オブジェクト。

This method might successfully return an object, an array of objects, or nil, depending on the kind of object specifier. Because nil is a valid return value, failure is signaled by invoking the object specifier’s setEvaluationError: method before returning.

Discussion 解説

You can override this method to customize the evaluation of object specifiers without requiring that the scripting container make up indexes for contained objects that don't naturally have indexes (as can be the case if you implement indicesOfObjects(byEvaluatingObjectSpecifier:) instead).

Your override of this method doesn't need to also invoke any of the NSScriptCommand error signaling methods, though it can, to record very specific information. The NSUnknownKeySpecifierError and NSInvalidIndexSpecifierError numbers are special, in that Cocoa may continue evaluating an outer specifier if they're encountered, for the convenience of scripters.

See Also 参照

Scripting スクリプトを書く