Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: Re: Need help cleaning up a script and adding loop

$
0
0

So I found another script you wrote on the forums that effects the canvas size, just need help with the math bits.  Here's what I've got now:

 

if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var wdth = app.activeDocument.width;
var hght = app.activeDocument.height;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
if(wdth % 4 == 0){  alert("width is divisible by 4");
}else{
myDocument.resizeCanvas(myDocument.width + 20, myDocument.height + 20, AnchorPosition.MIDDLECENTER)
}
};

Right now it's just adding 20px, but I need to make that whatever is needed in order to get the canvas to divide by 4. Math is not something I'm strong with, so if you've got any ideas, that would be great!


Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>