Copy link to clipboard
Copied
Hi - i was wondering if anyone can help? A while back someone kindly supplied me this script which will move all my text which has been coloured up in a specific colour to a new layer. Along with the text we also use leader lines for diagrams which are also coloured up in the same colour. Is there a way of also selecting lines that have been produced either with the pen tool or the line tool and move those to the same layer. The only thing they have in common is they are coloured up in the same colour.
Many thanks
var myDoc = app.activeDocument;
try{
var myLayer = myDoc.layers.add({name:"Text Black"});
}catch(e){myLayer = myDoc.layers.item('Text Black')};
myDoc.textFrames.everyItem().itemLayer = myLayer;
Hi There,
Try This code...
var myDoc = app.activeDocument;
try{
var myLayer = myDoc.layers.add({name:"Text Black"});
}
catch(e){
myLayer = myDoc.layers.item('Text Black');
}
myDoc.textFrames.everyItem().itemLayer = myLayer;
myDoc.graphicLines.everyItem().itemLayer = myLayer;
myDoc.polygons.everyItem().itemLayer = myLayer;
Best
Sunil
Copy link to clipboard
Copied
Hi,
Try using pageItem's constructor name to identify the items with color and then move into layer.
line drawn by line line tool - Constructor name return as GraphicLine
line drawn by pen tool - Constructor name return as Polygon
var pgItm = app.selection[0]
if(pgItm.constructor.name == "GraphicLine" || pgItm.constructor.name == "Polygon")
{
// code here
}
Copy link to clipboard
Copied
Hi - thank you for your reply but unfortunately it's not working. Pretty sure it's going to be something i'm doing wrong as I'm new to scripting.
Copy link to clipboard
Copied
Hi There,
Try This code...
var myDoc = app.activeDocument;
try{
var myLayer = myDoc.layers.add({name:"Text Black"});
}
catch(e){
myLayer = myDoc.layers.item('Text Black');
}
myDoc.textFrames.everyItem().itemLayer = myLayer;
myDoc.graphicLines.everyItem().itemLayer = myLayer;
myDoc.polygons.everyItem().itemLayer = myLayer;
Best
Sunil
Copy link to clipboard
Copied
Great - worked a treat once I'd ungrouped the elements. Out of interest would there be a way of setting the text black stroke to overprint?
Thanks again!!!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now