6 Replies Latest reply on Aug 26, 2013 7:46 AM by Peter Spier

    Prompt to Spell Check Before Printing, Save and/or Close Document?

    AmandaCole1989

      Hello,

       

      I need to set up some sort of script to promt myself to spell check before I print, save and/or close a document. After scouring the internet, I have come up with a script that was designed to run on CS3 (I am currently running on CS6). I have included the script below for reference. At first, this script worked and now it does not. I also tried modifying it, however I know little about JavaScript.

       

      Any other options on how to promt for spell check before printing, saving, and or/closing would also be greatly appreciated! Thanks in advance!

       

      SCRIPT:

       

      /* CheckSpelling.jsx

       

      Version 1

       

      This script is written to remind a user to spell-check the current document.

       

      Put this script into Startup scripts folder and restart InDesign if it's running. */

       

      #target indesign

       

      #targetengine "session"

       

      var myLastDoc;

       

      var myConfirm;

       

      var myCheckSpellEvList = app.menuActions.item("Check Spelling...").addEventListener("beforeInvoke", myCheckSpellHandler, false);

       

      var myBeforeCloseEvList = app.addEventListener("beforeClose", myBeforeCloseHandler, false);

       

      var myAfterCloseEvList = app.addEventListener("afterClose", myAfterCloseHandler, false);

       

      function myBeforeCloseHandler(myEvent){

       

         myConfirm = false;

       

         if (!eval(myEvent.parent.extractLabel("SpellingChecked")) && myEvent.parent.saved == true){

       

            myLastDoc = myEvent.parent.fullName;

       

            myConfirm = confirm("Do you want to check spelling now?", false, "You forgot to check spelling!");

       

         }

       

      }

       

      function myAfterCloseHandler(myEvent){

       

         if (!eval(myEvent.parent.extractLabel("SpellingChecked"))){

       

            if (myConfirm) {

       

               app.open(myLastDoc);

       

               app.menuActions.item("Check Spelling...").invoke();

       

            }

       

         }

       

      }

       

      function myCheckSpellHandler(myEvent){

       

         app.activeDocument.insertLabel("SpellingChecked", "true");

       

      }