2 Replies Latest reply on Sep 12, 2017 7:42 AM by JJMack

    Error 22: Window does not have a constructor

    Ghoulfool Level 1

      Straight out of the UI textbook we have

       

       

         // Create an empty dialog window near the upper left of the screen

         var dlg = new Window("dialog", "Alert Box Builder");

        dlg.frameLocation = [100,100];

        dlg.show();

       

       

      Half the time this works. The other half the time I get the error 22 Window does not have a constructor. Nice.

       

       

      Deleting Photoshop preferences doesn't seem to make a difference. The error pops up inconstantly. I can't upgrade from CC 9.1.2 as it's work machine. Running Win 7.

       

       

      As you can imagine this is just a teeny tiny bit frustrating. Is there a real solution to this? You know apart from defenestration?

        • 1. Re: Error 22: Window does not have a constructor
          Dale_ Level 1

          Does adding some properties help?

           

          var dlg = new Window("dialog", "Alert Box Builder", undefined, {closeButton: true});
            dlg.frameLocation = [100,100];
           var btn = dlg.add ('button', undefined, "I do nothing")
            dlg.show();
          
          • 2. Re: Error 22: Window does not have a constructor
            JJMack Most Valuable Participant

            OR This will work with either ScriptUI version. What is Photoshop CC 9.1.2????.  Photoshop version 9 is CS2????  CS6 has an ACR version 9.1.1...

             

            .frameLocation = [x,y] does not work in the new version of ScriptUI.  The Dialog will be centered on your display.

             

            var dlg = new Window("dialog", "Alert Box Builder", undefined, {closeButton: true});  
            dlg.frameLocation = [100,100];  
            var btn = dlg.add ('button', undefined, "I do nothing")  
            runDialog(dlg)
            function runDialog(dlg){
               dlg.onShow = function() {
                  var ww = dlg.bounds.width;  
                  var hh = dlg.bounds.height;  
                  dlg.bounds.x  = 100;  
                  dlg.bounds.y  = 100;  
                  dlg.bounds.width  = ww;  
                  dlg.bounds.height  = hh;  
               }
               return dlg.show()
            }
            
            1 person found this helpful