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

Document Action will close

Enthusiast ,
Dec 11, 2017 Dec 11, 2017

Hi ,

I'm trying to ask the user to change his mind if he didn't really want to exit from the (Opened PDF Doc),, so i go to Document Action at (Document will close) and write the following :

var cMsg = "Are you sure you want to close ?";

cMsg += "\n\n";

cMsg += "Contiunue ? \n\n ";

var nRtn = app.alert(cMsg,2,2,"Warning ! ");

if(nRtn == 4)

{// A yes Response

  // Code for doing the thing you do on a yes

  this.closeDoc();

}

else if(nRtn == 3)

{ // No Response

  //event.value = 0; // assume do nothing

  beep

  !this.closeDoc();

}

else  

{ //Unknown Response

  beep

  !this.closeDoc();

}

But the Above Code is Closing the Document even if the user hit yes or no? ho do i change it to not close the document if the user hit (No)... thanks for any tip

Best
Mohammad Hasanin
TOPICS
Acrobat SDK and JavaScript , Windows
3.2K
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 , Dec 11, 2017 Dec 11, 2017

The script can't abort the file close command. The only way is if the user closes the file using a button you added to it, which executes this code. But if they click the X button or File - Close or Quit, the file will close, no matter what.

Translate
Enthusiast ,
Dec 11, 2017 Dec 11, 2017

Yes, the final code is for button only

Best
Mohammad Hasanin
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