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

Find phrase with format in all document

$
0
0

Hi everyone!

 

I have a text that includes many times the phrase “All human beings”, and I want create a script to be sure the phrase are in BOLD and also the word “beings” are in BOLD and ITALIC.

 

This is my document:

All human beings

They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.

All human beings

Everyone has the right to life, liberty and security of person.



This is my script but didn't work:

 

var myDocument = app.documents.item(0);
//Clear the find/change grep preferences.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//Set the find options.
app.findChangeGrepOptions.includeFootnotes = true;
app.findChangeGrepOptions.includeHiddenLayers = true;
app.findChangeGrepOptions.includeLockedLayersForFind = true;
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
app.findChangeGrepOptions.includeMasterPages = true;
//Regular expression for finding a text
if(app.findGrepPreferences.findWhat = "<b>All human <i>beings</i></b>"){

}else{ alert ("the phrase: All human beings are WRONG")}

app.changeGrepPreferences.underline = true;
myDocument.changeGrep();
//Clear the find/change preferences after the search.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;

 

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 80307

Trending Articles