Skip to main content
Inspiring
Jan 26, 2018 9:01 PM UTC
Answered

dialog.end() not dismissing dialog

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 is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
Jan 26, 2018 9:16 PM UTC

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

4 replies

Inspiring
Jan 26, 2018 9:05 PM UTC

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?

Translate
Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Jan 26, 2018 9:16 PM UTC

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.

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Inspiring
Jan 26, 2018 9:34 PM UTC

Ahh thank you very much! That solved the problem.

Translate