Is it possible to get/retrieve width and height values from Photoshop when creating a plugin?
I have a Javascript function which relies on being able to find the ratio of the current document in order to proceed with either one of two separate functions.
So eventually I'd want to be able to write an if/else statement along the lines of:
if width/height < 1.5, then function1, else function2.
So I found the answer.
In your jsx file, you can either use:
app.activeDocument.width
or
app.activeDocument.height
Or - should you wish to retrieve those values from within your js file, you can use:
csInterface.evalScript('app.activeDocument.width.as("px")',function(result){
alert(result)
});
or
csInterface.evalScript('app.activeDocument.height.as("px")',function(result){
alert(result)
});