Why does closing a window in Indesign not work?

I have a question regarding an Indesign script.

Why does this work when you close a window like:

submitButton.onClick = function(){
    close();
}

But when I try to execute the function after, for example:

submitButton.onClick = function(){
    close();
    tagElements();
}

(note that I use the "with" tag, so no window.close())

The window does not close? Did I forget something? Should you not close the window and execute the function?

The window is initialized as follows:

var de = new Window('dialog', 'Descriptions');
+4
source share
4 answers

The following performed the trick:

with(de)
    submitButton.onClick = function(){
        close(1);
     }
}
if(de.show){
    tagElements();
}

de.show will be true when you pass '1' to the close function (1 == true). On the close button, you simply add 'close ()' and the if statement will be false.

0
source

close() de.close() . ;

var de = new Window('dialog', 'Descriptions');
btn = de.add('button', undefined, 'close');  
btn.onClick = function() {  
    de.close();
    alert('foo');
}
de.show();
+1

, ( ):

function pause(msec) { 
  var done = null; 
  var date = new Date(); 
  var curDate = null; 
  do curDate = new Date(); 
  while(curDate-date < msec); 
  var done = 1; 
  return done; 
} 

submitButton.onClick = function(){
    close();
    pause(500);
    tagElements();
}
0
source

You need a link to an open window in the code.

submitButton.onClick = function(){
de.close();
tagElements();
}

must work

0
source

All Articles