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

dialog.end() not dismissing dialog

Explorer ,
Jan 26, 2018 Jan 26, 2018

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?

TOPICS
Acrobat SDK and JavaScript , Windows
690
Translate
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

correct answers 1 Correct answer

Community Expert , Jan 26, 2018 Jan 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.

Translate
Explorer ,
Jan 26, 2018 Jan 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?

Translate
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 ,
Jan 26, 2018 Jan 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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
Explorer ,
Jan 26, 2018 Jan 26, 2018
LATEST

Ahh thank you very much! That solved the problem.

Translate
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 ,
Jan 26, 2018 Jan 26, 2018

The way to do it is to return a specific value back to the main thread when the dialog is closed, and then check that value and if necessary open a new dialog window right away.

Translate
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