: Photoshop Javascript - Resize not working correctly I have written a script in Javascript for photoshop which gets user input (number of boxes on the desktop) then converts it into pixel sizes.
I have written a script in Javascript for photoshop which gets user input (number of boxes on the desktop) then converts it into pixel sizes. The problem is on resizing, the layer doesn't change to that amount, it changes by that amount. Eg. microsoftbox starts at 800*800 then should change to 500*500 but adds that on to equal 1300*1300.
app.preferences.rulerUnits = Units.PIXELS;
//Get all input
var microsoftboxes = prompt("How many boxes for microsoft?");
var gamesboxesx = prompt("How many across boxes for games?");
var gamesboxesy = prompt("How many down boxes for games?");
var adobeboxes = prompt("How many boxes for adobe?");
var filesboxes = prompt("How many boxes for files?");
var toolsboxes = prompt("How many boxes for tools?");
var recycleboxes = 1;
//Add percentage on and convert to pixel num
var mb = microsoftboxes * 75;
mb = mb + (mb * 0.04);
var gbx = gamesboxesx * 75;
gbx = gbx + (gbx * 0.04);
var gby = gamesboxesy * 75;
gby = gby + (gby * 0.04);
var ab = adobeboxes * 75;
ab = ab + (ab * 0.04);
var fb = filesboxes * 75;
fb = fb + (fb * 0.04);
var tb = toolsboxes * 75;
tb = tb + (tb * 0.04);
var rb = recycleboxes * 75;
rb = rb + (rb * 0.04);
//vars for change size
var doc = app.activeDocument;
var m = doc.layers.getByName('microsoft');
var g = doc.layers.getByName('games');
var a = doc.layers.getByName('adobe');
var t = doc.layers.getByName('tools');
var f = doc.layers.getByName('files');
var r = doc.layers.getByName('recycle');
m.resize(mb, 73, AnchorPosition.MIDDLELEFT);
g.resize(gbx, gby, AnchorPosition.TOPCENTER);
a.resize(ab, 73, AnchorPosition.MIDDLELEFT);
f.resize(fb, 73, AnchorPosition.MIDDLELEFT);
t.resize(tb, 73, AnchorPosition.MIDDLELEFT);
r.resize(rb, 73, AnchorPosition.MIDDLELEFT);
Before
After
More posts by @Gonzalez368
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.