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();
I thought that would solve:
('statictext {text: characters: 3}');
Try...
dlg.gp.etxt.text =(doc.width.value.toFixed(1));
Copy link to clipboard
Copied
Try...
dlg.gp.etxt.text =(doc.width.value.toFixed(1));
Copy link to clipboard
Copied
dlg.gp.etxt.text = doc.width.value.toFixed(2) + " " + doc.width.type;
upd.
was late )
Copy link to clipboard
Copied
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.