Skip to main content
October 22, 2009
Question

How do I apply a Script to Master Pages?

  • October 22, 2009
  • 1 reply
  • 974 views

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);

This topic has been closed for replies.

1 reply

Kasyan Servetsky
Legend
October 22, 2009

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;

October 22, 2009

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

Kasyan Servetsky
Legend
October 22, 2009

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;