Skip to main content
Inspiring
January 26, 2018
Answered

dialog.end() not dismissing dialog

  • January 26, 2018
  • 1 reply
  • 767 views

I launch one dialog using app.execDialog(dialog1). Then in that dialog I have a button and if they click the button I dismiss the current dialog using:

"btn1": function(dialog) {

     dialog.end();

     app.execDialog(dialog2);

}

This works fine in Adobe Acrobat Pro DC on Mac, but on Windows it does not dismiss the original dialog. Any ideas?

This topic has been closed for replies.
Correct answer Thom Parker

The code is incompatible.  There is only one active dialog at a time, that's want being modal is about. There can only be one!! And this code is trying to start a new one before old one is gone. I'm surprised Acrobat behaved so well and didn't crash.

And you have another issue. the end function requires a string input. This is the value returned by the app.execDialog function.

1 reply

Inspiring
January 26, 2018

If I take out this line:

app.execDialog(dialog2);

then the dialog.end() works.

So why does opening a new dialog after dismissing the existing dialog prevent the existing dialog from getting dismissed?

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 26, 2018

The code is incompatible.  There is only one active dialog at a time, that's want being modal is about. There can only be one!! And this code is trying to start a new one before old one is gone. I'm surprised Acrobat behaved so well and didn't crash.

And you have another issue. the end function requires a string input. This is the value returned by the app.execDialog function.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Inspiring
January 26, 2018

Ahh thank you very much! That solved the problem.