Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Spellcheck start up script

Return to Forums

  • Author
    Posts
    • #87053
      Anonymous
      Inactive

      I am trying to create a start up script for when specific file types are printed in CS6. And I need the script to perform a couple of things.

      1. Checks if the document has more than one page, and if so it will ask the user if they would like to delete their extra pages.
      2. Check if the document has been spell checked, and if it hasn’t, I would like it to give the user the option to cancel the print dialog box and load up the spell check dialog box instead.

      So far I have got it to check the page numbers and if the document has more than one page it will ask if the user wants to delete the extra page. I have also got it to ask if the user wants to open the spell check dialog box.

      I have two problems at present though…

      1. I cannot find out how to check if a spellcheck has been performed as if it has already been done, I don’t want to give the user this option.
      2. If they do need to perform a spell check is there a way to automatically close the dialog box for the print option so that they can go straight into the spell check? At present I have to cancel the print manually before I can carry on with checking my documents spelling.

      You can see what I have below but any help will be much appreciated.


      #targetengine "session"

      main();
      function main(){
      var myEventListener = app.eventListeners.add("beforePrint", pagesSpelling);
      function pagesSpelling() {

      //-----------------------------------------------------------------------------------------------REMOVE EXTRA PAGES & SPELLCHECK
      function documentChecks(){
      {(SaveOptions.no);
      app.menuActions.item("Check Spelling...").invoke();
      }}

      // if only one page only ask if they want to spell check
      /*else*/ if (app.documents [0].pages.length <2 && app.activeDocument.documentPreferences.properties.pageHeight == 269){
      var win = new Window ("dialog","Spellcheck?");
      // Spell check Buttons (with function)
      b1 = win.add('button', undefined, "Continue");
      b2 = win.add('button', undefined, "Exit");
      win.defaultElement = b1;
      win.cancelElement = b2;
      function spellCheckResponse()
      {(documentChecks())
      }; ((win.show() == 1) ? spellCheckResponse()
      : ("") );
      }

      // only run page deletion script if 2 pages on doc and it meets the correct page dimensions
      if (app.documents [0].pages.length >1 && app.activeDocument.documentPreferences.properties.pageHeight == 269) {

      //~ // 2 Page & spelling dialog box
      var win = new Window ("dialog","Extra Page & Spellcheck");
      //button for spellcheck
      var myGroup1 = win.add('panel', undefined, '');
      myGroup1.alignChildren = "left";
      catButton1 = myGroup1.add ("radiobutton", undefined, "Spellcheck");
      catButton11 = myGroup1.add ("radiobutton", undefined, "No Spellcheck");
      catButton1.value = true;
      // button to delete extra page
      radio=win.add('panel', [0,0,454,23], "You have an extra page, would you like to delete it before printing"),
      b1 = win.add('button', undefined, "Yes"),
      b2 = win.add('button', undefined, "No");
      win.defaultElement = b1;
      win.cancelElement = b2;
      // variable below is dependant on whether you choose yes or no.
      var pStet = 0;
      (win.show() == 1) ? pStet = 2 : pStet = 1;
      // if they choose yes, line below deletes extra pages
      if (pStet == 2) {app.documents[0].pages.itemByRange(1,-1).remove()};

      if (catButton1.value==true)
      { documentChecks();}

      if (catButton11.value == true) {
      ("")}
      }
      }}

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
Forum Ads