Copy link to clipboard
Copied
Hello! How do I reset the text box information when I click the resize buttons again to either feed or shrink after clicking the reset button? What's missing? Thanks!
app.purge (PurgeTarget.HISTORYCACHES);
dlg = new Window("dialog"); dlg.text = "Resize Layer";
scala = 100;
dlg.preferredSize.width = 200; dlg.preferredSize.height = 80;
dlg.orientation = "column"; dlg.alignChildren = ["center","top"];
group1 = dlg.add("group"); group1.orientation = "row";
group1.alignChildren = ["left","center"];
t1 = group1.add("statictext"); t1.text = "Resize:";
t2 = group1.add("edittext"); t2.text = " " + scala + "%";
be = group1.add("button"); be.text = "R(+)";
br = group1.add("button"); br.text = "R(-)";
bt = group1.add("button"); bt.text = "Reset";
be.onClick = function() {
scala += 5; t2.text = "" + scala + "%"; resizerLayer(105, 105);
app.refresh();
}
br.onClick = function() {
scala -= 5; t2.text = "" + scala + "%"; resizerLayer(95, 95);
app.refresh();
}
bt.onClick = function(){
t2.text = " " + "100" + "%"
activeDocument.activeHistoryState = activeDocument.historyStates [1];
app.refresh();
}
dlg.show();
function resizerLayer(w,h){
var startRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PERCENT;
app.preferences.typeUnits = TypeUnits.PIXELS;
app.activeDocument.activeLayer.resize(w,h, AnchorPosition.MIDDLECENTER);
app.preferences.rulerUnits = startRulerUnits;
}
Add:
scala = 100;
somewhere in the bt.onClick = function()
Copy link to clipboard
Copied
Add:
scala = 100;
somewhere in the bt.onClick = function()
Copy link to clipboard
Copied
Thanks again for the support Chuck Uebele
Copy link to clipboard
Copied
Sure thing.