Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 93817

Re: Re: How can I find-change only in the master pages?

$
0
0

I would do it in this way:

 

// Your settings
// ---
var SEARCH_PATTERN = '2013';
var CHANGE_PATTERN = '2014';

// Set SEARCH
// ---
app.findTextPreferences = app.changeTextPreferences = null;
app.findChangeTextOptions.includeMasterPages = true;
app.findTextPreferences.findWhat = SEARCH_PATTERN;
app.changeTextPreferences.changeTo = CHANGE_PATTERN;

// Variables
// ---
var allDocs = app.documents,
    nDocs = allDocs.length,    nFounds = [],    counter = 0;   
// SEARCH ONLY MASTERPAGES IN ALL OPEN DOCS
// ---
for ( var i = 0; i < nDocs; i++ ) {    var curDoc = app.documents[i],    mPages = curDoc.masterSpreads.everyItem().pages.itemByRange(0, -1),    target = mPages.textFrames.everyItem().paragraphs.everyItem();    target.changeText();    nFounds.push(target.changeText().length);
}

app.findTextPreferences = app.changeTextPreferences = null;

for ( var i = 0; i < nFounds.length; i ++ ) {    counter = counter + nFounds[i];
}   

alert( counter + " expressions have been changed." );

 

– Kai


Viewing all articles
Browse latest Browse all 93817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>