4 Replies Latest reply on Oct 22, 2009 10:02 AM by drbruton77gbco

    How do I apply a Script to Master Pages?

    drbruton77gbco

      Hello,

      Please can anyone tell me how to run or edit this script correctly?

       

      I have a simple Find and Replace script that ran perfectly on CS2. Now I am running in CS4 and only the first part of the script works which applies the documents pages, but the second part, which applies to the master pages, does not.

      I tried running the CS2 script from “Adobe\InDesign\Version 6.0\en_US\Scripts\Scripts Panel\Version 4.0 Scripts” and it still does not work on the master pages.

       

      Thank you!

       

       

      // Dialog box request Section Information
      var mySectionName = prompt ('What is the Section Title?', 'Title', 'Assign Section Title');
      var myCompanyName = prompt ('What is the Client Company Name?', 'Title', 'Assign Company Name');
      // Create section template by applying Section Name
      app.findPreferences = app.changePreferences = null;

       

      // Document Pages - Apply Section Title
      app.activeDocument.search('Section Name', false, true, mySectionName);

       

      // Master Pages -  Apply Company Name
      app.activeDocument.search('Company Name', false, true, myCompanyName);

        • 1. Re: How do I apply a Script to Master Pages?
          Kasyan Servetsky Level 5

          I've remade the script for CS4.

           

          // Dialog box request Section Information
          var mySectionName = prompt ('What is the Section Title?', 'Title', 'Assign Section Title');
          var myCompanyName = prompt ('What is the Client Company Name?', 'Title', 'Assign Company Name');

           

          app.findTextPreferences = app.changeTextPreferences = null;

           

          app.findChangeTextOptions.caseSensitive = true;
          app.findChangeTextOptions.wholeWord = false;

           

          // Document Pages - Apply Section Title
          app.findTextPreferences.findWhat = 'Section Name';
          app.changeTextPreferences.changeTo = mySectionName;
          app.activeDocument.changeText();

           

          // Master Pages -  Apply Company Name
          app.findTextPreferences.findWhat = 'Company Name';
          app.changeTextPreferences.changeTo = myCompanyName;
          app.activeDocument.changeText();

           

          app.findTextPreferences = app.changeTextPreferences = null;

          1 person found this helpful
          • 2. Re: How do I apply a Script to Master Pages?
            drbruton77gbco Level 1

            Hello Kasyan

            I ran your script and it still only applied changes to the document and not the master. I really appreciate you giving it a shot. I am not sure what I am doing wrong.

            Thanks again,

            dbruton

            • 3. Re: How do I apply a Script to Master Pages?
              Kasyan Servetsky Level 5

              Oops! I failed to notice this.

               

              // Dialog box request Section Information
              var mySectionName = prompt ('What is the Section Title?', 'Title', 'Assign Section Title');
              var myCompanyName = prompt ('What is the Client Company Name?', 'Title', 'Assign Company Name');

               

              app.findTextPreferences = app.changeTextPreferences = null;

               

              app.findChangeTextOptions.caseSensitive = true;
              app.findChangeTextOptions.wholeWord = false;
              app.findChangeTextOptions.includeMasterPages = true;

               

              // Document Pages - Apply Section Title
              app.findTextPreferences.findWhat = 'Section Name';
              app.changeTextPreferences.changeTo = mySectionName;
              app.activeDocument.changeText();

               

              // Master Pages -  Apply Company Name
              app.findTextPreferences.findWhat = 'Company Name';
              app.changeTextPreferences.changeTo = myCompanyName;
              app.activeDocument.changeText();

               

              app.findTextPreferences = app.changeTextPreferences = null;

              • 4. Re: How do I apply a Script to Master Pages?
                drbruton77gbco Level 1

                Kasyan, you are my Hero! That works perfectly. Thank you so much!!