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

Bug - Extendscript editnumber control autorounds with workaround

Advocate ,
Sep 23, 2025 Sep 23, 2025

I've found a bug with the Extendscript editnumber control and a workaround. Please see my related post in the Bridge forum, the bug is slightly different. Tested on macOS PS 26.10 and Windows 10 Pro PS 25.12.4.

 

When a decimal number is entered into an editnumber control (in an Extendscript window), the decimal is incorrectly rounded to two decimal places. If the script requires more precision, there is a workaround. Please see the posted snippet.

 

To test, type in a number such as 0.00255. Without the workaround code, this is rounded to 0. With the workaround, the typed value is retained.

 

/*
This is a test snippet to demonstrate editnumber bugs in Photoshop.
Editnumber entry is autorounded to two decimal places.
This can be worked around with the code below.
*/
test();

function test(){
    try{
        var weight = '';
        rnWindow = new Window ('dialog', 'Editnumber Test', undefined, {closeButton:true});
        rnPanel = rnWindow.add('panel', [0, 0, 650, 540], '');
        rnPanel.num1 = rnPanel.add('editnumber {justify:"left"}', undefined, 0);
        rnPanel.num1.minimumSize  = [90, 20];
        rnPanel.button1 = rnPanel.add('button', undefined, 'Display');
        rnPanel.button2 = rnPanel.add('button', undefined, 'Close');
//workaround
        rnPanel.num1.onChanging = function(){
            weight = rnPanel.num1.value.toString();
            }
        rnPanel.num1.onDeactivate = function(){
            rnPanel.num1.value = eval(weight);
            rnPanel.num1.text = weight;
            }
//end workaround
        rnPanel.button1.onClick = function(){
            Window.alert(weight + '\r' + rnPanel.num1.value.toString());
            }
        rnPanel.button2.onClick = function(){
            rnWindow.close();
            }
        rnWindow.layout.layout(true);
        rnWindow.show();
        }
    catch(e){
        Window.alert(e + ' ' + e.line);
        }
    }

 

TOPICS
Actions and scripting , macOS , Windows
39
Translate
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
Adobe
Community Expert ,
Sep 23, 2025 Sep 23, 2025

Thank you for sharing, I usually only use editnumber for integers.

Translate
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
Advocate ,
Sep 24, 2025 Sep 24, 2025
LATEST

Yeah I'm not sure if its supposed to be for integers or a fixed number of decimals or what, documentation is lacking. I was getting odd results in a script and this is why.

Translate
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