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

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

$
0
0

Hi Kai

 

can you help correct this script:

 

 

        app.doScript('main()', ScriptLanguage.JAVASCRIPT , [], UndoModes.ENTIRE_SCRIPT, "Find-change digit" );          

 

function main(){ 

 

// Set SEARCH 

// --- 

app.findTextPreferences = app.changeTextPreferences = null; 

app.findChangeTextOptions.includeMasterPages = true; 

app.findTextPreferences.findWhat = "2017"; 

app.changeTextPreferences.changeTo = "2018"; 

 

app.findTextPreferences = app.changeTextPreferences = null; 

app.findChangeTextOptions.includeMasterPages = true; 

app.findTextPreferences.findWhat = "2015"; 

app.changeTextPreferences.changeTo = "2016"; 

 

app.findTextPreferences = app.changeTextPreferences = null; 

app.findChangeTextOptions.includeMasterPages = true; 

app.findTextPreferences.findWhat = "2014"; 

app.changeTextPreferences.changeTo = "2015"; 

 

app.findTextPreferences = app.changeTextPreferences = null; 

app.findChangeTextOptions.includeMasterPages = true; 

app.findTextPreferences.findWhat = "2013"; 

app.changeTextPreferences.changeTo = "2014"; 

 

// 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], 

    target = curDoc.masterSpreads.everyItem().pages.everyItem().textFrames.everyItem();   

    var allFounds = target.changeText(); 

   

    for (var n = 0; n < allFounds.length; n ++) { 

        var curFound = allFounds[n]; 

        if (curFound.length != 0) { 

            counter += curFound.length;

                }

        } 

    } 

 

app.findTextPreferences = app.changeTextPreferences = null; 

 

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

 

 

 

Teetan


Viewing all articles
Browse latest Browse all 87561

Trending Articles



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