Render.ru

Ещё несколько скриптов

#1
Выкладываю ещё несколько скриптов для выполнения задач, реализации которым я не нахожу в 10 Илле, но с которыми лично мне порой приходится сталкиваться. Для тех, кто не знает, скрипты нужно сохранить в отдельных файлах с расширением *.js Дальше удобно поместить их в папку "Program Files\Adobe\Illustrator 10\Presets\Scripts\" и они появятся в меню File - Scripts - ...
Собсна, вот они:

1)
/* Автоматическая замена каждого из всех выделенных объектов ключевым объектом (с подстройкой размера подставляемого объекта). Типа, как "Replace Symbol", только действует с любыми обектами (даже внутри групп и Compound Path). Ключевым объектом является самый нижний (по глубине) из выделенных */

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
ratio=100/(goal.width/currItem.width);
ratioV=100/(goal.height/currItem.height);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
if(ratio<ratioV){
newItem.resize(ratio,ratio,true,true,true,true,ratio)
}else{
newItem.resize(ratioV,ratioV,true,true,true,true,ratioV)
}
currItem.remove()
}
}
}else{}

2)
/* Автоматическая замена каждого из всех выделенных объектов ключевым объектом, только с сохранением размера подставляемого объекта. Ключевым объектом является самый нижний (по глубине) из выделенных.*/

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
currItem.remove()
}
}
}else{}

3)
/* Отображение разрешения выделенного объекта(ов). Выскакивает сообщение с цифрой разрешения. Если разрешения у них разные, то выскочит надпись "Resolutions are different" */

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
comRes=mySelection[0].resolution;
eq=true;
for (i=0; i<(mySelection.length); i++){
res=mySelection.resolution;
if(res!=comRes){
eq=false
}
}
if(eq){
alert(comRes)
}else{
alert('Resolutions are different')
}
}
}else{}
 
#2
Доработал 2 первых скрипта, и теперь полноценно объектом можно заменить и составляющие Бленда, и Clipping Path, и объекты в Compound Shape и объекты в группах.

1)
//Замена без изменения размера
mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
newItem.artworkKnockout=currItem.artworkKnockout;
newItem.clipping=currItem.clipping;
newItem.isIsolated=currItem.isIsolated;
newItem.evenodd=currItem.evenodd;
newItem.polarity=currItem.polarity;
newItem.moveBefore(currItem);
currItem.remove()
}
}
}else{}

2)
//Замена с изменением размера
mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
ratio=100/(goal.width/currItem.width);
ratioV=100/(goal.height/currItem.height);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
if(ratio<ratioV){
newItem.resize(ratio,ratio,true,true,true,true,ratio)
}else{
newItem.resize(ratioV,ratioV,true,true,true,true,ratioV)
}
newItem.artworkKnockout=currItem.artworkKnockout;
newItem.clipping=currItem.clipping;
newItem.isIsolated=currItem.isIsolated;
newItem.evenodd=currItem.evenodd;
newItem.polarity=currItem.polarity;
currItem.remove()
}
}
}else{}
 
#3
Хе-хе, моя рассеянность это не к добру. Забыл вписать строчку и скрипт №2 не работает корректно. Блин, на этом форуме нет ещё возможности редактировать сообщения. Итак, доделанный вариант скрипта №2:

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
ratio=100/(goal.width/currItem.width);
ratioV=100/(goal.height/currItem.height);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
if(ratio<ratioV){
newItem.resize(ratio,ratio,true,true,true,true,ratio)
}else{
newItem.resize(ratioV,ratioV,true,true,true,true,ratioV)
}
newItem.artworkKnockout=currItem.artworkKnockout;
newItem.clipping=currItem.clipping;
newItem.isIsolated=currItem.isIsolated;
newItem.evenodd=currItem.evenodd;
newItem.polarity=currItem.polarity;
newItem.moveBefore(currItem);
currItem.remove()
}
}
}else{}
 
#4
Нет предела совершенству, Muchacho. В этой теме ты поселился надолго :)))
 
#5
Уважаемый, Muchacho!

А не хотите ли Вы сделать что-то типа сайта по АИ скриптам (как у Батушева по ИД)?

Чтобы все было наглядно, заявочки, может быть, принимали бы? :))

Вот было бы здорово!!!
 
#6
Да у меня и скриптов-то ещё почти нет, да и Java я пока недостаточно хорошо знаю что б сайт такой созавать. Начинающий я. А сайт... тема не должна быть такой специализированной. Тогда уж сайт по Иллу вообще, но, опять же, я в этом не профи.
 
#7
Да ладно скромничать! :)

Вон Батушев, похоже, тоже не профи.... :)

Было бы желание......
 
#9
Вы будете смеяться (у него оригинальный адресс :)):

http://www.batushev.ru/

Удачи!
 
#10
Спасибо за ссылку. Ничего сайтец, молодец парень. Может быть, скопится достаточно материала и знаний, создам тоже какой-нибудь ресурсец. :) К сожалению, на этом форуме мало народа занимающегося скриптами для Илла, а ведь это большое поле для приложения рук самоделкиных.
 
#11
Прошу прощения, я опять доработал скрипты замены, т.к. там был небольшой баг.

1)
//Замена без изменения размера

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
newItem.artworkKnockout=currItem.artworkKnockout;
newItem.clipping=currItem.clipping;
newItem.isIsolated=currItem.isIsolated;
newItem.evenodd=currItem.evenodd;
if(currItem.polarity){
newItem.polarity=currItem.polarity;
}
newItem.moveBefore(currItem)
currItem.remove()
}
}
}else{}


2)
//Замена с изменением размера

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[mySelection.length-1];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=0; i<(mySelection.length-1); i++){
currItem=mySelection;
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
ratio=100/(goal.width/currItem.width);
ratioV=100/(goal.height/currItem.height);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
if(ratio<ratioV){
newItem.resize(ratio,ratio,true,true,true,true,ratio)
}else{
newItem.resize(ratioV,ratioV,true,true,true,true,ratioV)
}
newItem.artworkKnockout=currItem.artworkKnockout;
newItem.clipping=currItem.clipping;
newItem.isIsolated=currItem.isIsolated;
newItem.evenodd=currItem.evenodd;
if(currItem.polarity){
newItem.polarity=currItem.polarity
}
newItem.moveBefore(currItem);
currItem.remove()
}
}
}else{}
 
Сверху