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

Error 22: Window does not have a constructor

Engaged ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting

Views

2.4K

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
Adobe
Community Beginner ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

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();

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 ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

LATEST

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()

}

JJMack

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