1 Reply Latest reply on Aug 25, 2013 10:58 PM by Vamitul

    Run multiple scripts on a book file

    Asher31

      Hi all,

      So through the help of this forum and online articles i've slowly managed to put my script together, well actually for them to work it's 2 scripts (3 soon hopefully).

       

      There are two parts to my questions...

       

      1) How can i run more than one script at a time after each other (or put them in the same file to run after each other)?

       

      2) How do i change the target of the script from the active document to that of a/the book file (so i can run it on more than one document at a tim? I'm guessing it's changing "var myDoc = app.activeDocument," i just don't know what to.

       

       

      This is the code and the second script is about the same just for paragraphs

      // the section replaces character styles
      replaceStyle("", "strong", "DTP", "Bold");
      replaceStyle("", "em (2)", "DTP", "Light Italics");
      
      
      function replaceStyle(GroupOld , find, GroupNew, replace){
          try{
      var myDoc = app.activeDocument,
      importedStyle = myDoc.characterStyles.item(find),
      ApplyStyle = myDoc.characterStyles.item(replace);
      
      if (GroupOld) importedStyle = myDoc.characterStyleGroups.item(GroupOld).characterStyles.item(find) ;
      if (GroupNew) ApplyStyle = myDoc.characterStyleGroups.item(GroupNew).characterStyles.item(replace) ;
      
      importedStyle.remove(ApplyStyle);
          }
      catch(e){
          //alert (e)
          }
      }