Adobe 65009333 Scripting Guide - Page 47
Finding and changing formatting, FindChangeFormatting tutorial script
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 47 highlights
Text and Type Finding and changing text 47 The following script fragment shows how to find a specified string of text and replace it with a different string (for the complete script, see ChangeText): //Clear the find/change preferences. app.findTextPreferences = NothingEnum.nothing; app.changeTextPreferences = NothingEnum.nothing; //Set the find options. app.findChangeTextOptions.caseSensitive = false; app.findChangeTextOptions.includeFootnotes = false; app.findChangeTextOptions.includeHiddenLayers = false; app.findChangeTextOptions.includeLockedLayersForFind = false; app.findChangeTextOptions.includeLockedStoriesForFind = false; app.findChangeTextOptions.includeMasterPages = false; app.findChangeTextOptions.wholeWord = false; //Search the document for the string "copy" and change it to "text". app.findTextPreferences.findWhat = "copy"; app.changeTextPreferences.changeTo = "text"; app.documents.item(0).changeText(); //Clear the find/change preferences after the search. app.findTextPreferences = NothingEnum.nothing; app.changeTextPreferences = NothingEnum.nothing; Finding and changing formatting To find and change text formatting, you set other properties of the findTextPreferences and changeTextPreferences objects, as shown in the following script fragment (from the FindChangeFormatting tutorial script): //Clear the find/change preferences. app.findTextPreferences = NothingEnum.nothing; app.changeTextPreferences = NothingEnum.nothing; //Set the find options. app.findChangeTextOptions.caseSensitive = false; app.findChangeTextOptions.includeFootnotes = false; app.findChangeTextOptions.includeHiddenLayers = false; app.findChangeTextOptions.includeLockedLayersForFind = false; app.findChangeTextOptions.includeLockedStoriesForFind = false; app.findChangeTextOptions.includeMasterPages = false; app.findChangeTextOptions.wholeWord = false; //Search the document for the 24 point text and change it to 10 point text. app.findTextPreferences.pointSize = 24; app.changeTextPreferences.pointSize = 10; app.documents.item(0).changeText(); //Clear the find/change preferences after the search. app.findTextPreferences = NothingEnum.nothing; app.changeTextPreferences = NothingEnum.nothing;