2016-06-22 3 views
0

다양한 텍스트 및 경로 항목이 포함 된 일러스트레이터 문서가 있습니다. 모든 텍스트 항목을 반복하고 그 색상과 두 가지 속성을 변경하고 싶습니다. 그런 다음 항목 이름에 따라 같은 이름의 다른 항목과 그룹화합니다. 거의 작동하는 스크립트가 있습니다. 문제는 일부 항목을 남겨 두거나 불일치하게 무시한다는 것입니다. 때로는 그것들을 영향을 미치기도하고, 무시할 때도 있습니다.텍스트 항목을 반복하는 일러스트 레이터 페이지

//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); 
    }; 
}; 

답변

0

아래에 감사 어떤 도움, 스크립트 이에 대한 해결책은 루프를 반대하는 것입니다. 기본적으로 그룹으로 항목을 이동하면 페이지의 '느슨한'텍스트 항목 수가 변경되어 루프 길이가 효과적으로 중간 단계로 변경됩니다. 이것에 대한 좋은 시각적 설명은 https://forums.adobe.com/thread/2171307에서 찾을 수 있습니다. 나는 또한

이라는 질문을 게시했습니다.
관련 문제