2008年10月31日金曜日

Illustratorで変倍画像チェック

ある教えてサイトで困っている人に作ってあげたイラレ用の画像変倍チェックスクリプト。
実行すると、変倍の配置画像があればすべて選択された状態になり、ダイアログで何個あるか表示します。
画像にロック等がかかっているとうまく動作しないかも。
JavaScriptですので、Mac版でも動きます(確認してないけど)。

...

#target Illustrator

Application.active
doc = app.activeDocument;

doc.selection = null;

allPlaceItem = doc.placedItems;
for(i=0; i<allPlaceItem.length; i++){
tatehi = Math.round((allPlaceItem[i].boundingBox[1] / allPlaceItem[i].height) * 100,1);
yokohi = Math.round((allPlaceItem[i].boundingBox[2] / allPlaceItem[i].width) * 100,1);
if(tatehi != yokohi) allPlaceItem[i].selected = true;
}
alert("Henbai count = " + doc.selection.length);