Script for border in %
Hello,
I want to create a script to add a white border with my website as signature to an entire batch of images with different sizes.
I've researched here and I found a script but when I've tried to customize to my needs returns me error on the 7 line.
As i never used a script nor know how to code, could anyone assist me with this issue please?
I also would like the text to be centralized in "height" and "width" on the bottom white bar.
I've already sweated a lot to customize this simple text to what I would like to achieve.
Thank you very much!
if(documents.length) app.activeDocument.suspendHistory('Add Border', 'main()');
function main(){
var startRulerUnits = preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var fivePercent = (doc.height/100) * 20;
var OffsetX = twentyPercent;
var OffsetY = twentyPercent/4;
var White = new SolidColor();
White.rgb.hexValue = 'ffffff';
var White = new SolidColor();
White.rgb.hexValue = 'ffffff';
app.backgroundColor=White;
doc.flatten();
app.activeDocument.resizeCanvas((doc.width + (twentyPercent*2)), (doc.height + (twentyPercent*2)), AnchorPosition.MIDDLECENTER);
var newTextLayer = activeDocument.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.kind = TextType.POINTTEXT
newTextLayer.textItem.color = White;
newTextLayer.textItem.font = "Source Sans Pro Regular";
newTextLayer.textItem.size = 18;
newTextLayer.textItem.contents = "www.alessandro-vecchi.com";
var LB = doc.activeLayer.bounds;
var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);
var percentage = ((twentyPercent/LHeight)*50);
doc.activeLayer.resize(percentage,percentage,AnchorPosition.MIDDLECENTER);
LB = doc.activeLayer.bounds;
var X = (activeDocument.width - twentyPercent) - LB[2].value;
var Y = (activeDocument.height - OffsetY) - LB[3];
activeDocument.activeLayer.translate(X,Y);
doc.flatten();
preferences.rulerUnits = startRulerUnits;
}
