У меня есть иллюстратор с различными текстовыми и дорожными элементами на нем. Я хочу перебрать все текстовые элементы и изменить их цвет, а также несколько атрибутов. Затем в зависимости от имени элементов я хочу сгруппировать его с другими элементами с тем же именем. У меня есть скрипт, который почти работает. Проблема в том, что он оставляет некоторые элементы или игнорирует их непоследовательно. Иногда это влияет на них, в других случаях это просто игнорирует их. Любая помощь ценится, ниже сценарийЦитирование через текстовые элементы страницы иллюстратора
//Selects the graph before to scale them and turns off the pixel align so that values of 1 decimal place can be applied to strokes
doc.selectObjectsOnActiveArtboard();
var sel = doc.selection;
sel.pixelAligned=false
var item
var xLabels = layer.groupItems.add(); //create group for xAxis
xLabels.name="xLabels"
var yLabels = layer.groupItems.add(); //create group for xAxis
yLabels.name="yLabels"
var yTicks = layer.groupItems.add(); //create group for xAxis
yTicks.name="yTicks"
//Loops through ungrouped text items and set horizontal scale, spot black and tabular lining on figures
for (var i = 0; i < layer.textFrames.length; i++) {
item=layer.textFrames[i];
$.writeln (item)
item.textRange.characterAttributes.textFont = textFonts.getByName("Metric-Regular");
item.textRange.characterAttributes.figureStyle=FigureStyleType.TABULAR
item.textRange.characterAttributes.fillColor=myBlack;
//move labels on xAxis into the same group
if (item.name=="xAxisLabel") {
item.moveToEnd(xLabels);
}
//move labels on yAxis into the same group
if (item.name=="yAxisLabel") {
item.moveToEnd(yLabels);
};
};
for (var i = 0; i < layer.pathItems.length; i++) {
item=layer.pathItems[i];
if (item.name=="yAxisTick") {
item.moveToEnd(yTicks);
};
};