• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Reset text box values

Engaged ,
Jul 27, 2019 Jul 27, 2019

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; 

}

TOPICS
Actions and scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 27, 2019 Jul 27, 2019

Add:

scala = 100;

somewhere in the bt.onClick = function()

Votes

Translate

Translate
Adobe
Community Expert ,
Jul 27, 2019 Jul 27, 2019

Copy link to clipboard

Copied

Add:

scala = 100;

somewhere in the bt.onClick = function()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 27, 2019 Jul 27, 2019

Copy link to clipboard

Copied

Thanks again for the support Chuck Uebele

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2019 Jul 27, 2019

Copy link to clipboard

Copied

LATEST

Sure thing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines