欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

AI腳本選擇相同重疊文本 以避免文本對象重疊的現(xiàn)象

  發(fā)布時間:2015-04-27 14:19:40   作者:佚名   我要評論
這篇教程是向腳本之家的朋友AI腳本選擇相同重疊文本,以避免文本對象重疊的現(xiàn)象。一起來看看吧

腳本之家的朋友們,大家好。我是腳本之家會員胡說八道。今天給大家?guī)淼倪@個教程像腳本之家的朋友們介紹用AI腳本選擇相同重疊文本,難度中等。算是和朋友們分享一個技巧吧!

該腳本可以選擇重疊的文本對象,以避免文本對象重疊的現(xiàn)象產生。
注意:文本對象必須相同,即內容、大小寫。

要用“文件-腳本”來使用,以CS3為例應放在"C:\Program Files\Adobe\Adobe Illustrator CS3\預設\腳本"下。
當然,也可以放置在其他文件夾中,通過Ctrl+F12定位到腳本所在處來使用。
復制以下全部文字到記事本中,保存為以.js結尾的腳本文件(如:腳本.js)即可。


復制代碼
代碼如下:
/////////////////////////////////////////////////////////////////
//Select Replicated (Overlaping) Text Items v.1 -- CS,CS2
//>=--------------------------------------
// This script removes all duplicate overlaping text items from a document.
// The ONLY parameters it checks are top and left coordinates, and text contents.
// Anchor points within one point of each other are considered the same.
// (tolerance can be adjusted by changing the 'tolerance' value.)
//
// The lower duplicate objects are selected for manual removal.
//
//>=--------------------------------------
// JS code (c) copyright: John Wundes ( john@wundes.com ) www.wundes.com
//copyright full text here: http://www.wundes.com/js4ai/copyright.txt
//////////////////////////////////////////////////////////////////
var selName = "僅本文檔中)";
if(selection.length >0){
selName = "current selection";
var sel= activeDocument.selection;
var selectedTextFrames = new Array(0);
for (var all in sel){
if(sel[all].typename == "TextFrame"){
selectedTextFrames.push(sel[all]);
}
}
sel = selectedTextFrames;
} else{
var sel= activeDocument.textFrames;
}
var dupeTextFrames= new Array(0);
var tolerance = 1;
var slen = sel.length;
for(var all=0; all checkDupe(sel,all);
}
//
alert(dupeTextFrames.length + " 個重疊的相同文本對象被找到("+selName+"");
if(dupeTextFrames.length>0){
activeDocument.selection = [];
for (all in dupeTextFrames){
dupeTextFrames[all].selected = true;
}
}
//---------------------------------------
function checkDupe(ob,n){
//t == objects so far
for(var t=0; t <n></n> if(ob[t].typename == "TextFrame"){
if (isWithin(ob[n].left,ob[t].left,tolerance) &&
isWithin(ob[n].top,ob[t].top,tolerance) &&
ob[n].contents == ob[t].contents){
dupeTextFrames.push(ob[n]);
break;

}
}
}
}
function isWithin(YposA,YposB,tol){
if(YposA==YposB){return true};
if(findDiff(YposA,YposB) return true;
}
return false;
}
function findDiff(a,b){
if( a>0 && b>0 && b>a ||
a<0 && b>0 ||
a<0 && b<0 && a>b ){
return Math.abs(b-a);
}
return Math.abs(a-b);
}

相關文章

最新評論