Answered
Get Fi, tsume, kerning information using script?
Hello every one~
I have a question...
Is it possible to access or get information from these items via script? I tried to find out but the results say it is not possible.

Hello every one~
I have a question...
Is it possible to access or get information from these items via script? I tried to find out but the results say it is not possible.

This may help get you started.
// type layer properties;
// based on code by michael l hale;
// 2024, use it at your own risk;
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID('textKey'));
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
checkDesc2 (textDesc, true);
// check kerning list;
var theCollection = new Array;
var kerningList = textDesc.getList(stringIDToTypeID('kerningRange'));
for (var o = 0; o < kerningList.count; o++) {
var thisList = checkDesc2(kerningList.getObjectValue(o), false);
theCollection.push(thisList);
};
alert ("kerning ranges\n"+theCollection.join("\n"))
// check ligature;
var theResults = new Array;
var aList = textDesc.getList(stringIDToTypeID('textStyleRange'));
for (var o = 0; o < aList.count; o++) {
var thisList = checkDesc2(aList.getObjectValue(o), false);
var ligature = aList.getObjectValue(o).getObjectValue(stringIDToTypeID('textStyle')).getBoolean(stringIDToTypeID('ligature'));
theResults.push(thisList+"ligature "+ligature+"\n");
};
alert ("results\n"+theResults.join("\n"))
};
//////
////// based on code by michael l hale //////
function checkDesc2 (theDesc, theAlert) {
var c = theDesc.count;
var str = '';
for(var i=0;i<c;i++){ //enumerate descriptor's keys
str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';
};
if (theAlert == true) {alert("desc\n\n"+str);
return};
return str
};
////// check //////
function getValues (theDesc, theNumber) {
switch (theDesc.getType(theDesc.getKey(theNumber))) {
case DescValueType.ALIASTYPE:
return theDesc.getPath(theDesc.getKey(theNumber));
break;
case DescValueType.BOOLEANTYPE:
return theDesc.getBoolean(theDesc.getKey(theNumber));
break;
case DescValueType.CLASSTYPE:
return theDesc.getClass(theDesc.getKey(theNumber));
break;
case DescValueType.DOUBLETYPE:
return theDesc.getDouble(theDesc.getKey(theNumber));
break;
case DescValueType.ENUMERATEDTYPE:
return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStringID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));
break;
case DescValueType.INTEGERTYPE:
return theDesc.getInteger(theDesc.getKey(theNumber));
break;
case DescValueType.LISTTYPE:
return theDesc.getList(theDesc.getKey(theNumber));
break;
case DescValueType.OBJECTTYPE:
return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObjectType(theDesc.getKey(theNumber))));
break;
case DescValueType.RAWTYPE:
return theDesc.getReference(theDesc.getData(theNumber));
break;
case DescValueType.REFERENCETYPE:
return theDesc.getReference(theDesc.getKey(theNumber));
break;
case DescValueType.STRINGTYPE:
return theDesc.getString(theDesc.getKey(theNumber));
break;
case DescValueType.UNITDOUBLE:
return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUnitDoubleType(theDesc.getKey(theNumber))));
break;
default:
break;
};
};
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.