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

Question about characters in statictext in dialog box!

Contributor ,
Nov 20, 2017 Nov 20, 2017

Copy link to clipboard

Copied

How do I get only 3 numbers, (maximum 2 numbers after the dot) in statictext?

#target photoshop 

var doc = activeDocument; 

app.preferences.rulerUnits = Units.CM; 

 

dlg = new Window('dialog','Final Width Size'); 

dlg.gp = dlg.add('group'); 

dlg.gp.stxt = dlg.gp.add('statictext',undefined,'Width Size'); 

dlg.gp.etxt = dlg.gp.add('statictext {text: "Centre", characters: 3, justify: "center"}');

dlg.btn = dlg.add('button',undefined,'Close'); 

  dlg.gp.etxt.text =(doc.width)*1; 

 

dlg.btn.onClick = function (){ 

    dlg.close(); 

    } 

 

dlg.show();

Screenshot_3.jpg

I thought that would solve:

('statictext {text: characters: 3}');

TOPICS
Actions and scripting

Views

566

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

Guide , Nov 20, 2017 Nov 20, 2017

Try...

dlg.gp.etxt.text =(doc.width.value.toFixed(1));  

Votes

Translate

Translate
Adobe
Guide ,
Nov 20, 2017 Nov 20, 2017

Copy link to clipboard

Copied

Try...

dlg.gp.etxt.text =(doc.width.value.toFixed(1));  

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
People's Champ ,
Nov 20, 2017 Nov 20, 2017

Copy link to clipboard

Copied

dlg.gp.etxt.text = doc.width.value.toFixed(2) + " " + doc.width.type;

upd.

was late )

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
Contributor ,
Nov 20, 2017 Nov 20, 2017

Copy link to clipboard

Copied

LATEST

Now it works like a marvel!

SuperMerlin, thank you for the tip!

r-bin,your suggestion also worked very well, it will be very important.

Thank you both for sharing your knowledge. I am very happy with the results.

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