-
Scripting for Bounding box around text or AI file
Before I starting breaking my head around this issue. Is it possible to code this type of scenario:
Select any text layer or AI text file. Then add a bounding box (shape layer or one line stroke) on top of it ? I was able to create a shape layer on on the middle on canvas so far. My knowledge is limited as for now. Is it possible? If not possible, is okay 🙂
function addShapeOnTop (){
var project = app.project;
var comp = project.activeItem;
if(comp === null){
alert(‘Please select a text layer or AI file to continue’);
return
};
app.beginUndoGroup(Layer on top”)
var shapeLayer = comp.layers.addShape();
shapeLayer.name = “Shape on top”;
var rectangleGroup = shapeLayer.property(“Contents”).addProperty(“ADBE Vector Group”);
rectangleGroup.name = “Rectangle”;
var pathGroup = shapeLayer.property(“Contents”).property(“Rectangle”).property(“Contents”).addProperty(“ADBE Vector Shape – Rect”);
var pathStroke = shapeLayer.property(“Contents”).property(“Rectangle”).property(“Contents”).addProperty(“ADBE Vector Graphic – Stroke”);
var pathFill = shapeLayer.property(“Contents”).property(“Rectangle”).property(“Contents”).addProperty(“ADBE Vector Graphic – Fill”);
};
app.endUndoGroup();
I would love to be able to TIP for the huge help on this site, specially Dan, but I couldn’t find a way here. It’s only fair for you to take the time and help. It’s incredibly appreciate it.