Skip to main content
Inspiring
October 19, 2015
Question

Does El Capitan OS X cause problems with script driven dialog boxes?

  • October 19, 2015
  • 2 replies
  • 715 views

When running the folllowing with OS X El Capitan

Running a very simple test:

var w = new Window('dialog', 'Descriptions');

btn = w.add('button', undefined, 'close'); 

btn.onClick = function() { 

    w.close();

   // the window should be closed when the alert is pops up.

    alert('foo’);

}

w.show();

// the window

var a = 10;

var c = 10;


WIth EL Capitan it does not close the dlalog or the alert until the script completes running.



This topic has been closed for replies.

2 replies

Inspiring
October 21, 2015


This problem has taken a large chunk of my time in the last couple of days.


I have been able to qualify the issue and the issue has started with the Introduction of El Capitan.

The issue with dialog boxes not closing properly can be demonstrated by doing the following steps

1. Open InDesign and Extend script.  Add the following to a testscript:
     var w = new Window('dialog', 'Descriptions');
     btn = w.add('button', undefined, 'close');
     btn.onClick = function() {

             w.close();

             // the window should be closed when the alert is pops up.

              alert('foo’);

          }

          w.show();

          // the window show be closed if the you set a break point here.
          var a = 10;

          var c = 10;
          When running the script, will see that the dialog with the 'close' button closes before the alert dialog pops up.  This is the correct behavior.

2. Put the following at the top of the script:


#target "indesign"


Re run the script. You will see that the dialog with the close button does not close and the alert dialog pops up.  This is the incorrect behavior.


3) Remove the # target line from the script.  When you run the script again, the incorrect behavior occurs again.

4) Closing ExtendScript  and reopening  it and InDesign will cause the correct behavior to be shown, if you re-run the script.

5) Removing the #target is not an option for applications. If you and you try to reference the document using:

     currentDoc = app.activeDocument;

current document value is undefined.

Any clues from anyone for a workaround?

Trevor:
Legend
October 19, 2015

This is the normal way to do it.  It has nothing to do with El Captain.

var w = new Window('dialog', 'Descriptions');

var doMyStuff = false;

btn = w.add('button', undefined, 'close');

btn.onClick = function() {

    w.close();

    doMyStuff = true

}

w.show();

if (!doMyStuff) exit();

alert('foo');

// the window

var a = 10;

var c = 10;

HTH

Trevor

Inspiring
October 19, 2015

Agreed that is the correct way of doing it.  The problem did occur wth 11.1.0.122 build with El Capitan.  There was InDesign update today that corrected the problem, so the above code now works correctly!  Yesterday, it would display 'Descriptions' dialog even after the w.close(); was executed. Which is the wrong behaviour.


Ergo, the question.

Community Expert
October 20, 2015

Hi Bill, as far as I know, the update of InDesign was for the DPS Desktop Tools.
The current version number is still 11.1.0.122. I think, your problem was fixed in a different way.
Or do you see a new version number for InDesign on El Capitan?

Uwe