Checking for Character Key Sets part 3


We’ve already seen two ways to get at the IsCharacterKeySet parameter: 1) using the GetValue command, and 2) using XSICollection.Items.

Now, here’s a third way, using Dictionary.GetObject(). Dictionary.GetObject takes a string name and returns the corresponding object:

var oProp = Selection(0);
var oParam = Dictionary.GetObject( oProp + ".IsCharacterKeySet" );
LogMessage( oParam.Value );

So what’s the best way to get IsCharacterKeySet? One thing to consider is that GetValue and Dictionary.GetObject both fail if the string does not resolve to an object. XSICollection.Items, on the other hand, won’t fail; you just have to check the .Count property after to see whether you got the parameter.

Using XSICollections to check for character key sets


The IsCharacterKeySet parameter is not [directly] exposed through the Object Model, so you can’t get at the parameter through the Parameters or even NestedObjects. Instead, you can access the IsCharacterKeySet parameter with the GetValue and SetValue commands.

XSICollection does, however, provide an Object Model way to get at the parameter:

LogMessage( isCharKeySet( Selection(0) ) );

function isCharKeySet( o )
{
	var oColl = new ActiveXObject( "XSI.Collection" );
	oColl.items = o.FullName + ".IsCharacterKeySet";
	return ( oColl(0) != null && oColl(0).Value == true );
}