[ Branched ] Additional text changes in [JS] Script for border in %
SuperMerlin you are awesome.
Allow me to make one more question.
The text is huge, is not respecting the measure or the font type set in the
script and is not in a new layer.
I've tried to change the value on the script but nothing changes. Can you
please help me with this last one?
This is the entire script now:
#target photoshop;
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 = (Math.min(doc.height,doc.width)/100) * 20;
var OffsetX = fivePercent;
var OffsetY = fivePercent/4;
var Black = new SolidColor();
Black.rgb.hexValue = '696969';
var White = new SolidColor();
White.rgb.hexValue = 'ffffff';
app.backgroundColor=White;
doc.flatten();
doc.resizeCanvas((doc.width + (fivePercent*2)), (doc.height +
(fivePercent*2)), AnchorPosition.MIDDLECENTER);
var newTextLayer = activeDocument.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.kind = TextType.POINTTEXT
newTextLayer.textItem.color = Black;
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 = ((fivePercent/LHeight)*50);
doc.activeLayer.resize(percentage,percentage,AnchorPosition.MIDDLECENTER);
LB = doc.activeLayer.bounds;
var X = (activeDocument.width - (LB[2] - LB[0])) / 2;
var Y = (activeDocument.height - OffsetY) - LB[3];
doc.activeLayer.translate(X -LB[0],Y);
doc.flatten();
preferences.rulerUnits = startRulerUnits;
}
As usual, THANK YOU!
[ branched by moderator from Script for border in % ]
Aktualisiert
Super Awesome Merlin,
as i can't see my last question I will post again.
You made it and it works but the text doesn't follow the instructions of the script regarding size and font.
Also the text is not in a new layer.
I'm attaching an image so you can see. The canvas size is 4428 x 3263.
What I must do?
Thank you

