手机
当前位置:查字典教程网 >平面设计 >Illustrator教程 >AI脚本选择相同重叠文本 以避免文本对象重叠的现象
AI脚本选择相同重叠文本 以避免文本对象重叠的现象
摘要:查字典教程网的朋友们,大家好。我是查字典教程网会员胡说八道。今天给大家带来的这个教程像查字典教程网的朋友们介绍用AI脚本选择相同重叠文本,难...

查字典教程网的朋友们,大家好。我是查字典教程网会员胡说八道。今天给大家带来的这个教程像查字典教程网的朋友们介绍用AI脚本选择相同重叠文本,难度中等。算是和朋友们分享一个技巧吧!

AI脚本选择相同重叠文本 以避免文本对象重叠的现象1

该脚本可以选择重叠的文本对象,以避免文本对象重叠的现象产生。

注意:文本对象必须相同,即内容、大小写。

要用“文件-脚本”来使用,以CS3为例应放在"C:Program FilesAdobeAdobe 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);

}

【AI脚本选择相同重叠文本 以避免文本对象重叠的现象】相关文章:

AI脚本分割文本框

AI设计时尚简洁风格的巧克力汉堡包图标

Illustrator制作海底世界(上)

ai智能参考线的使用、开启和AI智能参考线失效的原因

AI快速添加斜阴影的方法和过程

Illustrator运用渐变网格绘制人物和头发

Illustrator绘制精美三维图表实例

AI制作温馨甜美数码照片贺卡技巧

AI色彩混合功能制作彩色光碟

AI给垂直视图如何添加阴影

精品推荐
分类导航