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

腳本之家的朋友們,大家好。我是腳本之家會(huì)員胡說八道。今天給大家?guī)淼倪@個(gè)教程像腳本之家的朋友們介紹用AI腳本選擇相同重疊文本,難度中等。算是和朋友們分享一個(gè)技巧吧!
該腳本可以選擇重疊的文本對(duì)象,以避免文本對(duì)象重疊的現(xiàn)象產(chǎn)生。
注意:文本對(duì)象必須相同,即內(nèi)容、大小寫。
要用“文件-腳本”來使用,以CS3為例應(yīng)放在"C:\Program Files\Adobe\Adobe Illustrator CS3\預(yù)設(shè)\腳本"下。
當(dāng)然,也可以放置在其他文件夾中,通過Ctrl+F12定位到腳本所在處來使用。
復(fù)制以下全部文字到記事本中,保存為以.js結(jié)尾的腳本文件(如:腳本.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 + " 個(gè)重疊的相同文本對(duì)象被找到("+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);
}
相關(guān)文章
ai怎么混合兩種顏色? illustrator混合兩個(gè)色塊的顏色的方法
ai填充不同顏色的圖形重疊以后,想要將兩種顏色混合,該怎么混合顏色呢?下面我們就來看看詳細(xì)的教程2024-07-18ai如何自定義網(wǎng)格線間距? ai參考線間距的調(diào)節(jié)方法
ai網(wǎng)格線間距默認(rèn)的不是很喜歡,想要自己調(diào)整一下,該怎么調(diào)整呢?今天我們就來看看參考線調(diào)整技巧2024-05-28ai路徑平均效果怎么用? illustrator使用平均路徑的教程
Adobe Illustrator中有一個(gè)路徑平均功能,如何使用呢?下面小編為大家演示路徑平均功能的一種使用方法2024-05-21ai保存pdf格式出現(xiàn)多余內(nèi)容怎么解決? 去掉pdf文件多余內(nèi)容的技巧
ai保存pdf格式出現(xiàn)多余內(nèi)容怎么解決?ai中的文檔保存為pdf文件的時(shí)候,發(fā)現(xiàn)有多余內(nèi)容,該怎么操作呢?下面我們就來看看去掉pdf文件多余內(nèi)容的技巧2023-12-19- ai描邊在哪里?ai中想要設(shè)置描邊,該怎么操作呢?下面我們就來看看ai設(shè)置描邊的多種方法2023-12-19
ai原位復(fù)制怎么用? ai原位復(fù)制快捷鍵介紹
ai原位復(fù)制怎么用?復(fù)制圖形的時(shí)候,想要原位復(fù)制粘貼,該怎么操作呢?下面我們就來看看ai原位復(fù)制快捷鍵介紹2023-12-19ai怎么讓文字隨著路徑變形? illustrator區(qū)域文字不跟著變換方向問題的
ai怎么讓文字隨著路徑變形?選中文字后,發(fā)現(xiàn)文字不跟隨變換區(qū)域旋轉(zhuǎn)該怎么辦呢?下面我們就來看看illustrator區(qū)域文字不跟著變換問題的解決辦法2023-11-30ai漸變色怎么調(diào)方向? illustrator將漸變顏色反向的技巧
ai漸變色怎么調(diào)方向?ai中給圖形填漸變色,想要進(jìn)行反向,該怎么操作呢?下面我們就來看看illustrator將漸變顏色反向的技巧2023-11-30Ai彩色logo怎么做反白反黑效果? ai彩色logo轉(zhuǎn)化為黑白稿的技巧
Ai彩色logo怎么做反白反黑效果?設(shè)計(jì)的彩色logo想要做黑白稿,就是反黑反白效果,下面我們就來看看ai彩色logo轉(zhuǎn)化為黑白稿的技巧2023-11-12ai怎么設(shè)計(jì)迷宮字體效果? ai做3d立體迷宮字的技巧
ai怎么設(shè)計(jì)迷宮字體效果?我們需要使用分割網(wǎng)格結(jié)合形狀生成器工具,制作迷宮字體,下面我們就來看看詳細(xì)的設(shè)計(jì)過程2023-11-02