Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
resizeSelection(100,200);
/////////////////////////////////////////////////////////
//A selection must be made first
/////////////////////////////////////////////////////////
function resizeSelection(horizontal, vertical){
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
var SB = activeDocument.selection.bounds;
var Height = SB[3].value - SB[1].value;
var Width = SB[2].value - SB[0].value;
var onePixH = 100/Height;
var onePixW = 100/Width;
var newWidth = onePixW * horizontal;
var newHeight = onePixH * vertical;
activeDocument.selection.resize( newWidth , newHeight, AnchorPosition.MIDDLECENTER );
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
}