Reply To: Alert message before exporting PDF

#113680
Masood Ahmad
Participant

Hi @Kai Rübsamen,

Hope you’re well.

Sorry to bother you again. But I need your help to refine the below code.

I was looking for a script to run spell check before closing a file. So with some help from my colleague and using your code we created a code that is filling our requirements.

I also tried to get some help from Adobe but there’s no response. So I have to come back to my favourite team.
https://forums.adobe.com/thread/2521329

The code is working fine i.e.
a) A message pops-up when a user closes a file;
b) If the user press No, then it open the Spell-Check dialog box;
c) If the user press Yes, then the file gets closed; BUT
d) It pops-up another message with Yes/No.

Can the last pop-up message be disabled. Any help would be much appreciated.


#targetengine "Reminder to run the Spell Check before Closing a file"

app.addEventListener("beforeClose", onClose);

function onClose(myEvent) {
var result = confirm("Have you run the Spell-Check?", true, "WARNING");

if (result == true) {
return
};

else (result == false) {
myEvent.stopPropagation();
myEvent.preventDefault();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
app.menuActions.item("Check Spelling...").invoke();
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
};
}

This article was last modified on January 16, 2019

Comments (0)

Loading comments...